Mortgage giant Fannie Mae earned $1.8 billion from July through September, helped by an improving housing market that has lifted home prices.