However, purchasing a house it is not just an inflation hedge. It comes with a house you can live in! This is an attractive quality for many of us humans who like living in homes.
Really though, I would argue that housing in aggregate is not a good hedge against inflation because while it is true that the price of an average square foot of housing in the United States has gone up almost zero percent adjusted for inflation over the last 50 years, you have had to do 50 years of maintenance on it, 50 years of insurance premiums, 50 years of paint, siding, roofing, etc. And a 5% realtor commission. By definition, it has therefore, on average, trailed inflation.
If you are looking at specific houses, in specific areas, that's not "housing is a good hedge against inflation" it's "if we look at the winners in a speculative market, we find that they have won" which isn't so much an investment philosophy as a tautology.
That said a mortgage may be a good hedge against inflation but only by virtue of it being a long-duration fixed-interest debt facility with preferential interest treatment at income tax time. And 5X leverage.
A house is not a stock, bond, or number in a savings account. You get utility from living in it as well.
A 0% ROI would however make that investment unattractive for 3rd parties who don't live in the house.