We do it. It’s not yet economically worth it but I’ve seen installs. I can’t find it but I saw one that was designed to let a massive shower run continuously with very little heat loss - the water coming out the end of the drain was as cold as the inlet water from the main.
What efficiency are these? Brainstormed this a bit and feels like shower cabins (pretty popular over NE Europe) should have such system as standalone... As in - it collects waste, collects heat and stores it for next shower. Dunno how much energy a typical refrigerant can store tho. Also great fit for Japanese-style smart baths (press a button and water of desired temperature fills and stays warm), tho they seem rare outside Japan.
There are systems that replace the shower drain with something like a heat exchanger, the water is warmed with the drain water right away, no need to store the heat. For example https://www.oeko-energie.de/shop1/de/eco-shower-duschrinne.h... (in German, but the image is simple to understand.)
I think they can recover up to 60-70% of the heat in the drain water. Not bad for totally passive. The installs I have seen are on the main drain for the whole house and located right next to the hot water heater. For it to really work you need a hot water tank, but I have seen some small tanks combined with tankless.
Wish we found a solid way yo harvest heat from waste water. So much energy is wasted on showers - similar to EV driving at highway speeds.