Since the government took over Fannie Mae and Freddie Mac, taxpayers have spent more than $160 million defending the mortgage finance companies and their former top executives in civil lawsuits accusing them of fraud. The cost was a closely guarded secret until last week, when the companies and their regulator produced an accounting at the request of Congress. The bulk of those expenditures — $132 million — went to defend Fannie Mae and its officials in various securities suits and government investigations into accounting irregularities that occurred years before the subprime lending crisis erupted. The legal payments show no sign of abating. Documents reviewed by The New York Times indicate that taxpayers have paid $24.2 million to law firms defending three of Fannie’s former top executives: Franklin D. Raines, its former chief executive; Timothy Howard, its former chief financial officer; and Leanne Spencer, the former controller.