It is called retrofit recirculation. The pump goes at the water heater, and a device called a crossover valve goes under the sink at the farthest away location. The pump can be on a timer or switch. There is also a temperature switch so that when water at the far end is about 80º ( and ready to get hotter!) the pump turns off.
The modest heat loss and electric cost of the pump is made up for by the convenience and not having to waste water down the drain waiting for it to get hot.
There is a side effect: You will briefly have warm (~80º) water from the cold tap each time you turn it on.
Google 'grundfos comfort system' to learn about these. There are other brands and variations, but the idea is the same.