The real calculation is the total monthly cost of ownership plus any sale prices on the buying and selling ends over the period, relative to the total costs of renting.
Over the 10 years we've owned our home, yes, it's been worth it to buy, because we can recoup money that would have gone to someone else.
However, over a short period, the sales costs would dwarf any returns we would get.
The sales costs are largely fixed on both ends, as a percent of home value, and diminish as a total percent of gains over the period of ownership. So the period of ownership is relevant.
This in turn is relevant because your mobility becomes relevant.
The previous market we were in too, was so overpriced relative to the rental cost that we actually saved money over the period by renting rather than buying. Then the Great Recession happened.
Either strategy makes sense depending on your mobility risk and the market. I don't think it's clear that one or the other is generally better.