That's not 'generally' true, unless youre cherry picking data or buying expensive houses. If that was true, then landlords wouldn't be renting their property out. The standard landlord advice (from any real estate book) is to charge more for rent than your mortgage costs to cover unexpected repairs. Also, several deductions for tax, maintenance, repairs, insurance, etc exist making it even cheaper. https://www.nolo.com/legal-encyclopedia/top-ten-tax-deductio...
I agree with you that owning a home is expensive and I caution friends from buying a home if they're not sure they want to live there for 5-15 years. The hidden costs are insane. Renting has a mostly stable price without the massive emergency spikes of making roof or foundation repairs.