The above is the rule of thumb though. You have to run numbers for your life situation as they constantly change. Note that some of the numbers are for your life situation which itself can change. Renting is often better just if you buy and have to move there is a bunch of negatives.
Owning a home, I'm investing the difference I save by not having to rent. Difficult to see how a renter can come ahead unless the time horizon is just a couple years.
Rents only ever (mostly) go up. Mortgages only go down (refinances). Those lines can cross in just a few years into ownership. By now, renting the same house I own is about 4x more expensive.
One thing you really don't want when going into retirement is a constantly and unpredictably increasing housing cost when you'll be on a fixed income.