Banks don't take deposits and they don't lend money. Banks create money.
When they "lend," what they are legally doing is purchasing a newly issued security for your home. And they are doing so with created money, that money is not transferred from some other account.
Similarly when you "deposit," the money is legally now the bank's. The bank now has a liability to you, but it is not a custodial intermediary "holding" your money for you.
It is poorly understood that banks are in fact creating credit. Most people believe in either the fractional reserve model of banking or in the financial intermediary model.
This is a real problem, because as they create credit to finance existing asset purchases (as opposed to financing new investment) they create asset price inflation & bubbles and foster inequality.
Read anything by the brilliant Richard Werner who writes about this extensively, this interview has a short summary of how banks actually work in law: https://youtu.be/EC0G7pY4wRE https://professorwerner.org/shifting-from-central-planning-t...