Electric or gas hot water heater runs about $400 with $200 for the install. So for less than $700 here. Obviously YMMV.
Now I paid $3800 for mine. This is what I got ...
80 gallon tank, solar collector on roof, all plumbing to roof, and auto valves to manage solar stuff.
Then utility gave me $1000 back, net $2800
It also never uses the electrical backup 4500 watt element. Maybe 5 days a year.
and you aren’t paying to heat water all the time, just in use, my electric bill dropped by almost 2/3 when i put in the tankless system