Financial gain is always the result of taking some type of risk. A small risk, like the risk associated with a traditional savings account, results in a very small potential gain. A larger risk, like what is associated with an individual stock, carries significantly more risk, but has the potential for much greater gain.
When you take out a mortgage, part of the interest you pay compensates the bank for the risk they are taking that you won't pay them back. Even with secured debt like a mortgage, the bank is incurring a risk. The bank spreads this risk over a number of different loans.