How did hospitals spend the extra money? Perhaps unsurprisingly, they started treating more Medicare patients — about 8 percent more per year. They also expanded nursing staffing by roughly a third, and invested in new technologies. But extra cash also meant big raises for hospital C.E.O.s: nearly half a million dollars per year at each hospital. Over all, “high 508 recipient hospitals” had $1.25 billion in additional spending from 2005 to 2010 — about 25 percent more than they otherwise would have. There was no evidence of improved quality or outcomes.

“If you told me in advance that we’d find this tight a link between Congress and hospitals, I would have been very surprised,” Mr. Cooper said. “We knew there was some connection, of course, but the more we kept digging, the stronger and more precise the link became.”

Section 508 payment changes were supposed to expire after three years. But hospitals with lucrative waivers had considerable interest in seeing the program extended, and worked together to form the Section 508 Hospital Coalition.

In the years between passage of the M.M.A., and its reauthorization in 2007, legislators in districts with a Section 508 hospital saw a 22 percent rise in total campaign contributions, and a 65 percent increase in donations from the health care sector specifically. In the end, a provision that budgeted $900 million over three years led to billions in extra spending for nearly a decade.

Pork, it seems, is as bad for budgets as it is for waistlines.

“Every time you pass legislation, big or small, these elements are added in,” Mr. Cooper said. “It’s not that any single one is hugely offensive. It’s their accumulation and continuation over time.”

Although Mr. Cooper’s research offers perhaps the clearest empirical glimpse of the links between lobbying, earmarks and medical spending, this political maneuvering is not new — and Medicare hospital payment seems to be a particularly susceptible target.

Both Democrats and Republicans have won pay increases for hospitals they represent. In the 1999 budget, the House Republican whip, Tom DeLay, and House Speaker Dennis Hastert reclassified hospitals in their districts into other regions, leading to hundreds of thousands of dollars of extra funding per year.