Heat exchangers are extremely efficient. You use the 500C water to heat 400C water, then use your 400C water to heat 300C water etc etc. It still takes energy, but you recover over 90% of it.
Stopping pollution is difficult, and filtering water is expensive, but boilers are well established technology.