A mortgage is (typically) a fixed monthly payment for 30 or 15 years. The fact the mortgage is a fixed payment provides protection from rental market volatility and also inflation. The main forward risk you have (beyond actually being able to pay the bill) is deflationary risk and changes in property tax policy that would increase your monthly costs to maintaining your ownership.
It's an investment only if you plan to sell (of course everyone would sell at the right price, so perhaps its an academic point.) But it's also a way to control risk.