I'm no financial guru or anything but from what I understand, the banks are allowed to lend money that they don't physically possess in the first place. It's called quantitative easing. They just pluck money out of thin air and put it on a screen. So the borrower works for 30 years to pay the bank almost three time the original amount that the bank never really lent. Win win for the banksters.
My house is almost paid off but the taxes keep going up. So we'll never really own the property, because the government needs there cut.
It's all on balance sheets and in general ledgers, constantly being shifted back and forth. The whole banking system is based upon a complicated system of borrowing and lending, with promises to pay back loans with, as you note, a massive amount of interest when seen over the entire term of the mortgage. And even though it doesn't relate to banking and loans
per se, yes, there are taxes to pay too. Fail to pay your taxes, you lose your home, and the government is far more aggressive in collecting its taxes, than mortgage lenders are in getting delinquent borrowers to make their loan payments. A highly disproportionate amount of effort, labor, and man-hours goes into chasing down that 3 to 4 percent of borrowers who don't pay, or who pay late. Borrowers who pay on time, every time, require almost no effort, the servicing fee recouped from each month's payment is basically a predictable cash cow for the bank, "like shooting fish in a barrel", the easiest money that bank will make.
No lender wants to foreclose. In actual practice, they will work with you, and will exercise the utmost patience, exhausting every avenue to get things to a point where you have a loan that you
can repay.
They do not want that house. The taxing authority, OTOH, doesn't mind putting your home into a tax sale, they have no "skin in the game", no asset on which they've loaned money.