There are a few fundamental things a landlord provides:
- Avoiding cost of transitioning a property. Government, insurers, and lawyers make transitioning ownership of a house expensive. That by itself erases about a year of typical 'equity' gains. If you have to mortgage, then net loss is likely over the first couple of years. If you know you will leave in say 4 years or less, this has value.
- Ease of leaving. If you own, you can't just immediately cash in and move out with the proceeds. If you have to move, you get stuck having to pay for two residences until you can manage to offload.
- Potentially access to rent a home when no one will loan you money. On top of being only there for college, when I started renting I had no history, so no bank would have loaned me money anyway, certainly not at a reasonable rate. Sometimes landlords will have as strict a credit requirement as banks, but it's at least more likely to find a willing landlord than a bank willing to risk the loan.
This comes together for renting making a whole lot of sense for people on a remote work assignment, college students, and seasonal occupants who need a residence for a few months or a couple of years. Also for people who have just moved out on their own and need a residence while they get some credit history under their belt, hopefully being in a situation like university where the need is short term as well.