Freddie Mac’s roughly $500,000 in payments to Davis & Manafort began immediately after Freddie Mac and Fannie Mae in late 2005 disbanded an advocacy coalition that they had set up and hired Mr. Davis to run, the people familiar with the arrangement said.

From 2000 to the end of 2005, Mr. Davis had received nearly $2 million as president of the coalition, the Homeownership Alliance, which the companies created to help them oppose new regulations and protect their status as federally chartered companies with implicit government backing. That status let them borrow cheaply, helping to fuel rapid growth but also their increased purchases of the risky mortgage securities that were their downfall.

Image Rick Davis, left, with Senator John McCain in 2007. Credit... Stephan Savoia/Associated Press

On Sunday, in an interview with CNBC and The New York Times, Mr. McCain responded to a question about Mr. Davis’s role in the advocacy group through 2005 by saying that his campaign manager “has had nothing to do with it since, and I’ll be glad to have his record examined by anybody who wants to look at it.”

Such assertions, along with McCain campaign television ads tying Mr. Obama to former Fannie Mae chiefs, have riled current and former officials of the two companies and provoked them to volunteer rebuttals. The two officials with direct knowledge of Freddie Mac’s post-2005 contract with Mr. Davis spoke on condition of anonymity. Four other outside consultants, three Democrats and a Republican also speaking on condition of anonymity, said the arrangement was widely known among people involved in Freddie Mac’s lobbying efforts.

As president of the Homeownership Alliance, Mr. Davis got $30,000 to $35,000 a month. Mr. Davis, along with Fannie Mae and Freddie Mac, have characterized the alliance as a coalition of many housing industry and consumer groups to promote homeownership, but numerous current and former officials at both companies say the two mortgage companies created and bankrolled the operation to combat efforts by competitors to rein in their business. They dissolved the group at the end of 2005 as part of cost-cutting in the wake of accounting scandals and, at Freddie Mac, a lobbying scandal that forced out its former top Republican lobbyist.

On Monday, the McCain campaign accused The New York Times of bias for reporting the payments to Mr. Davis for the alliance work from the mortgage giants. Mr. Davis said that he had worked not for the two companies but for the advocacy group, which included other nonprofit organization as well, and was focused only on promoting homeownership.