This is often not true.
I know its a popular belief with alot of millennial but anyone who has looked at a rent buy calculator quickly realizes for many areas (not the bay area / inflated housing markets beyond what the fundamentals support) buying still makes more sense than renting.
For instance, I'm considering a $325k purchase in an area where the equivalent rent is $1700/month.
https://www.nytimes.com/interactive/2014/upshot/buy-rent-cal...
Even with correcting the variables, the break even point is ~$1400/month if I sell in 5 years.
That is ~$3600/year in savings over 5 years or about the cost of replacing my car in the next 5 years.