Inverters with transformers feature something called electrical isolation. This is a safety barrier between the solar electric circuit and the utility grid connection.
It offers two advantages: first, DC volatge from the solar array - no matter how high - cannot get through to the utility grid side and cause damage. Secondly, the direct current side is not impacted in any way by the grid’s alternating current. In the case of transformer-less inverters, which can offer higher efficiency values, an insulation and fault current monitoring system isolates the solar installation from the grid in the event of a fault.