The US government has taken over mortgage giants Freddie Mac and Fannie Mae - the two companies which account for nearly half of the outstanding mortgages in the US , and have lost billions of dollars during the US housing crash .