Well in Germany there is the "Vorkaufsrecht" for the renter.
If I would sell my flat, the renter would have the option to buy it for the negotiated price. Not any imaginary price. There has to be a notarized sales contract which triggers the "Vorkaufsrecht".
The renter has the option to buy the house / flat at the established market price.