The Secondary Mortgage Market is where home loans and servicing rights are bought and sold between lenders and investors. Most home loans in the US are eventually sold to the secondary mortgage market.
When a consumer obtains a home loan, that loan is underwritten, funded and serviced by a bank or lending institution. Since the bank has used their own funds to make the loan, they will eventually run out of money to loan, so they will sell the loan to the secondary market to replenish their money available to make more home loans.
Often a loan is sold to a large aggregator like Fannie Mae or Freddie Mac. The aggregator, in turn, packages thousands of similar loans into a mortgage-backed security (MBS). These securities are then sold to investors on Wall Street who include governments, pension funds, insurance company and hedge funds.