Converting Sun to electricity to power a water heater is suboptimal. The water can be heated directly by the Sun. If you can put a water tank above the solar panel, you don't even need a pump.
From a purely efficiency standpoint, yes, but practically, electricity->heat is a lot cheaper to install. Plumbing is messy, and bolting on a water circulation system to a roof is harder than delivering more joules over the wires.
Having gone through one ice-dam related roof leak in the past, I'm also not thrilled with the idea of superheated liquids hanging out casually above my bedroom while I sleep.