Written forms may change, but the underlying root determines the morphological class.
VerbFirst radicalMiddle radicalFinal radicalClass
وَلِيَوليSeparated doubly weak
طَوَىطويAdjacent doubly weak
أَغْنَىغنيYāʾ-final
سَمَّىسموWāw-final
Both أَغْنَى and سَمَّى end in alif maqṣūrah on the surface. The former derives from final yāʾ and the latter from final wāw, so their categories differ.