Primary lenders make money on the fees you pay when the loan is made and on the interest they collect over the life of your loan. However, if you have a thirty-year loan, it will take the primary lender thirty years to make all its money. This ties up money the lender has available to make loans into one property and borrower for the life of the loan. If the primary lender sells the loan, it makes an immediate profit on its money, albeit less than if it had kept the loan for the full thirty years, and gives it money to continue making other loans.
A primary lender can also make money on servicing the loan it sells. This means that the primary lender still sends out your monthly statement and collects the money, but it then forwards it to the company that bought your loan. In other words, the primary lender acts as an administrator of sorts for a loan it sells, and then charges a fee for performing that service.