Waste water heat recovery, which heat exchanges with inlet water, would probably be more effective than heat exchanging with a fridge. Realistically both options are too costly for the limited benefit.
I looked into waste water heat recovery a few months back and it is a thing you can buy. You buy a special section of pipe that has a straight pipe with another pipe coiled around it. Some of the heat from the waste water gets transferred to the water coming in as they flow past each other in the pipes. They cost a few hundred bucks. I have no idea if the long term savings justify the cost (if you're looking purely at money for benefits).
These exist for showers, shower heat exchangers let the drained hot water exchange heat with the cold water tube to the shower.
Even for a furnace or boiler, condensing the steam in the exhaust only makes it around 10% more efficient.