Again where are you getting your info?
Stock investments yield way less over a long period (10 years example) than home prices and the home prices are more stable and predictable than stock and MUCH more predictable than investing in commodities which can put you belly up if you invest in say corn and then the corn crop dies from an epidemic... (which happens a lot sadly).
Home loan payments are less than rental for a number of reasons (it's not always true but often true) one reason being that the people who own the rental properties also have mortgages on the homes and so they have to cover the cost of the mortgage PLUS make some profit, so the rental price is higher than the mortgage price, it's just that many renters don't have the money for a down payment of 20% in order to get a mortgage, or don't have good enough credit to get a loan.
I do believe in some diversity, that at least we agree on, but overall the home values are often much higher than stock value increases.
Yes there are tax benefits as well, and they are significant in the US so that helps. You can also "roll" over your mortgage if you upgrade your house without paying any capital gains tax.
I don't know about your country, here... I'll just use my house as an example, the 2 family I have, in a dilapidated neighborhood, (which means the rental prices are actually good for renters and bad for landlords) my house mortgage per month is $2,300 on a 30 year mortgage, that includes taxes and insurance cost. .. the downstairs rent is $1,000 and the upstairs rent is $1,600 which yields $2,600 - $2,300 = $300 profit per month = $3,600 per year - $2,000 average maintenance = $1,600 net profit... this covers the home cost and then a little extra. 20 years from now that will sell for at LEAST $500,000 if not more and I've only invested $5,000 total to buy, fix up, refinance, and rent.
NOW that is based on a 2 family house, but say I lived in the first apartment, I would only be paying even after maintenance $866 per month if I lived there instead of rented to someone.
It's still cheaper than rent, and an investment in the future.
I was pretty good at stocks too, but made way less than on the house.
The market fell out everywhere and yes I lost my shirt, but in the long haul it will be better than having rented.
I don't know the specificities of the US markets. Taxes and government favouring home buying might distort the market.
When you invest a sum you invest it in something that intrinsically yields something. A sheep yields wool, a cow yields milk. A house yields a rent (if you live in your own house it yields a figurative rent) but that, historically, is far below the average return on capital on, let's say, the stock exchange. I mean the average sheep (or manufacturing etc.) historically yields more than the average house.
When you invest money (let's say in the stock exchange, and you go for high-dividend shares, e.g. you buy utilities, oil pipes etc.) you diversify. It's easy to make a portfolio in which no single investment is more than let's say 3% of your capital. The "risk" of the wise investor is spread among various firms and various sectors and countries.
If the mortgage is cheaper than the rent then there must be some force in the market distorting prices (for instance, tax deductions on the interest of the mortgage being higher than tax deductions on rent). I agree that if and when the mortgage is lower than the rent (no down payment considered) it would be foolish to rent.
Your house needs a flow of money just to preserve its value. This is normally considered to be around 15% of the annual rent. You then have taxes normally (I don't know in the US).
In my country the economic condition are set in deep favour of renting, yet we have one of the greatest percentages of home owners in the world and people consider rent to be "wasted money". It's entirely a cultural, prejudicial distortion in my view. There's a huge amount of second houses (mostly kept empty as "reserve of value" under the assumption that "houses always go up" which are now heavily taxed).
The desirability of a house (quarter, zone etc.) is more unpredictable than the stock exchange. In the very long run, the stock exchange will inevitably raise in value (because Homo oeconomicus creates value, capitalism creates value) while house value is largely dependent on demographic phenomena and movements.
In the last decades, all over the world people moved from the countryside to the town. That made the value of town houses to rise and, very importantly and frequently omitted, the value of countryside houses to fall. We have "phantom villages" in Italy as well, those houses are investments which was totally destroyed by demographic movements. We cannot exclude that internet will cause a contrary movement, from town to countryside, reversing the house value trend of the last decades.
But my point was different. If you believe in real estate, normally (tax distortions and bubble busting aside) investing in real estate and renting will yield you more in any case. You mileage may vary depending on your local house market, your tax laws etc. obviously.