They sold mortgages/notes ON houses. AND then took the houses that defaulted and sold them.
They made money on the loan
They made money on the write off
They made money on the sale of real property after
They also made money betting on the loans failing