In the "olden" days, when someone wanted a home loan they walked downtown to the neighborhood bank or savings & loan. If the bank had extra funds laying around and considered you a good credit risk, they would lend you the money from their own funds.
It doesn't generally work like that anymore. Most of the money for home loans comes from three major institutions:
Fannie Mae (FNMA - Federal National Mortgage Association)
Freddie Mac (FHLMC - Federal Home Loan Mortgage Corporation)
Ginnie Mae (GNMA - Government National Mortgage Association)
This is how it works:
You talk to practically any lender and apply for a loan. They do all the processing and verifications and finally, you own the house and now you have a home loan and you make mortgage payments. You might be making payments to the company who originated your loan, or your loan might have been transferred to another institution. The institution where you mail your payments is called the "servicer," but most likely they do not own your loan. They are simply "servicing" your loan for the institution that does own it.
You see, what happens behind the scenes is that your loan got packaged into a "pool" with a lot of other loans and sold off to one of the three institutions listed above. The servicer of your loan gets a monthly fee from the investor for servicing your loan. This fee is usually only 3/8ths of a percent or so, but the amount adds up. There are companies that service over a billion dollars of home loans and it is a tidy income.
At the same time, whichever institution packaged your loan into the pool for Fannie Mae, Freddie Mac, or Ginnie Mae, has received additional funds with which to make more loans to other borrowers. This is the cycle that allows institutions to lend you money.
What Freddie Mac, Ginnie Mae, and Fannie may do after they purchase the pools, is break them down into smaller increments of $1000 or so, called "mortgage backed securities." They sell these mortgage backed securities to individuals or institutions on Wall Street. If you have a 401K or mutual fund, you may even own some. Perhaps you have heard of Ginnie Mae bonds? Those are securities backed by the mortgages on FHA and VA loans.
These bonds are not ownership in your loan specifically, but a piece of ownership in the entire pool of loans, of which your loan is only one among many. By selling the bonds, Ginnie Mae, Freddie Mac, and Fannie Mae obtain new funds to buy new pools so lenders can get more money to lend to new borrowers.
And that is how the cycle works.
So when you make your payment, the servicer gets to keep their tiny part, and the majority is passed on to the investor. Then the investor passes on the majority of it to the individual or institutional investor in the mortgage backed securities.
From time to time your loan may be transferred from the company where you have been making your payment to another company. They aren't selling your loan again, just the right to service your loan.
There are exceptions.
Loans above $227,150 do not conform to Fannie Mae and Freddie Mac guidelines, which is why they are called "non-conforming" loans, or "jumbo" loans. These loans are packaged into different pools and sold to different investors, not Freddie Mac or Fannie Mae. Then they are securitized and for the most part, sold as mortgage backed securities as well.
This buying and selling of mortgages and mortgage backed securities is called "mortgage banking," and it is the backbone of the mortgage business.