But surely the interest makes up for this. It wouldn't make financial sense for the lender otherwise; why lend money to homeowners if it won't beat inflation than, say, invest it in the stock market?
In the US, the interest is tax deductible, so if you have earnings to match against that, the effective interest rate to the buyer is only 2/3rds of the nominal rate on the mortgage.