It is because of refinancing.
Banks charge interest to cover costs. Among these costs are the costs of delinquent loans. Suppose your bank has lent you X dollars, and your collateral is a house worth X dollars. The bank has some risk of your loan becoming delinquent. If your chance of delinquency decreases, the bank should be willing to let you pay a lower interest rate. If your house has increased in value to 2X dollars, it is less likely that you will default on your X dollar loan. So the bank could accept a lower interest rate.
Despite being able to do so, I am not sure why the bank would voluntarily accept to take less money. Perhaps it is in the contract that they have to, or you can threaten defaulting or early repayment. (Perhaps it is a subprime mortgage bond and reevaluation is in the bank's interest, as it can sell the bond at a higher price.)
Either way, the bank reassesses your risk and gives you a lower interest rate. Many people taking out loans were expecting this and accepted teaser loans that charged lower interest rates in the first few years of the loan. After these years the interest rates would increase to levels they could not afford - unless they refinanced the loans. They could only do this on good terms if the value of their houses went up.
I could not find an article that explains the basics of refinancing, but here is a paper on its effects:
Systemic Risk and the Refinancing Ratchet Effect by Khandani, Lo and Merton (2009).