So, if you've borrowed (say) 400k and inflation is (say) 10%, and you work in any sector really, the likelihood is that you'll have a wage increase to some extent. The real value of your money won't change as you'll be paid more in, but spending more, so your real income doesn't increase. On the other hand, the 400k that you borrowed is static (it's not quite that simple cos you're paying interest on it). So whilst you're earning more money (but in real terms not earning any more) then the bank is not really making anything on the mortgage as whilst the real value of money has decreased, the value of the mortgage has gone with it.
so if you were earning 50k and for some reason your employer was a normal person and increased your wages in line with inflation, then you're on 55k. The bank can just increase the money they've lent you to 440k, so in essence the bank (or the state if you want to think in that way) is taking the hit on inflation. With interest rates recently at all time lows, you would have been best to buy a house around 2010-2014 but I suppose that sage advice probably isn't an awful lot of use right now.
Hopefully that makes sense.