Bank of America said its fourth-quarter earnings shrank as it cleaned up old problems from its mortgage unit.

The bank made $367 million in the last three months of 2012, down from $1.6 billion in the same period a year ago. The earnings were equivalent to 3 cents per share. FactSet's consensus earnings estimate for Bank of America was 2 cents a share.

Bank of America agreed to pay Fannie Mae $3.6 billion and buy back some loans it sold to Fannie Mae for an additional $6.75 billion.