I hear this alot but don’t fully know the process that led to the boom in sub prime mortgages and banks profits.
How did the banks make money from selling packaged up sub prime mortgages to investors, and why would the investors buy them?
Where these investors the likes of Goldman Sachs and Lehman Bros?

Well, it is complicated, but basically, the loan is discounted. In other words, the loan that is made has an amount of interest that will be paid over the term of the loan. This interest is the profit a company can make.
For example, if you made a loan for $50,000 and over the term of say 10 years, you pay back $75,000 then there is a $25,000 profit. The banks and mortgage companies would sell the loan to the investors for this amount and a fee of say $2,000. Now, the shareholder will make a profit of only $23,000. The bank basically makes $2,000 for putting all the red tape together and the shareholder makes $23,000 for the use of their money over the next 10 years.
If the mortgage is defaulted, then the shareholder has to deal with selling the home, casing the costs of that foreclosure and etc. The bank but, has already made their $2,000 profit for doing the red tape and is now moving on to the next customer.