OK, so where does the money come from?
There's a lot of places that money comes from when you're dealing with a bank. Almost all of it is "borrowed" in some way (it's not the right technical term, but it works for our analogy without getting into a uni course on the subject). That can be from shareholders investing and expecting a return, your savings accounts known as deposits, bank balance sheets or bonds amongst other things.
Overall, lending for home loans takes a lot of money. I mean lots. Australia is now totalling into the TRILLIONS lots of money.
When we all chip in a few thousand dollars in our savings account, it's going to take a lot of us to get to the billions of dollars in home loans that are made every year right? So that's where other parties come into it. It's not just deposits, but also superannuation funds, institutional investors (big businesses globally who operate in the capital markets to raise a LOT of money) and even other banks. For some non-bank lenders, it can even be a fund that your average mom and dad investors can invest in.
This is covered in a little more detail right here - Ever wondered how your mortgage is funded?