Yes, grid-tie inverters are legal in the US, though there are certain regulations you may need to follow.
Most states allow power providers to use net metering, which means excess electricity from your solar panels is fed back to the grid (11). Net metering can save homeowners significant amounts on their monthly power bills.
Others have purchase and sale agreements in which the power company pays for the excess electricity your home provided at a much lower wholesale rate.