It was a rare issue in Washington that had support from both parties at the expense of Wall Street firms and the healthcare industry: lawmakers were determined to end surprise medical billing.

Yet after more than a year of rule proposals, negotiations and public outcry, the final measure — part of the $2.3 trillion package that Congress passed Monday — was seen largely as a win for the likes of Blackstone Group Inc. and KKR & Co. and the medical staffing companies they own. The Covid-19 pandemic was a big reason why.

Victory came after an intense advertising and lobbying campaign that framed some plans to ban surprise billing as a blow to doctors and hospitals just as they’re most needed, according to people familiar with the effort. Advocates for the private equity-backed medical companies, TeamHealth and Envision Healthcare, told lawmakers that slashing pay for emergency room doctors and anesthesiologists on the front lines treating Covid patients was akin to cutting the salaries of first responders in the wake of the 9/11 attacks.

Covid “shifted the politics of the issue,” said Zack Cooper, an associate professor of health policy and economics at Yale University. “Healthcare spending has gone down a lot during the pandemic and there has rightly been a lot of focus on the courageous work of emergency room physicians across the country, so it’s hard to pass reforms that lower spending on emergency room care.”

Under the new rules, doctors and hospitals can’t charge patients fees on most out-of-network care that their insurers won’t cover, and patients’ financial responsibility for emergency care from such providers is limited. But an arbitration process for payment disputes between insurers and providers is a win for the healthcare companies. That ensures higher payouts than what would have been available to them with an outright ban.

But private equity-backed providers didn’t get everything they were seeking.

“It’s not clear-cut to me that this is actually more favorable to providers,” said Loren Adler, associate director of the USC-Brookings Schaeffer Initiative for Health Policy. “They certainly won some concessions from a political lobbying perspective, but the bill is written with guard rails that limits the risks to rising payments.”

While the law means private equity firms will earn less from these staffing companies, their pull in the U.S. Capitol reversed what looked like a resounding defeat. The industry has grown by trillions of dollars in the past decade without significant regulatory oversight, and it took a pandemic that overwhelmed hospitals and killed more than 300,000 people in the U.S. to give them an edge on a political issue that could have crippled their investments.

“Against the backdrop of Covid-19, it’s more important than ever that Congress supports front-line healthcare providers and protects patient access to care, and we feel this compromise proposal to end surprise medical billing does just that,” KKR-backed Envision said in a statement. “In between the passage of this legislation and its implementation, patients should know they will not receive a surprise bill from Envision Healthcare.”

Surprise medical bills come when patients unexpectedly receive out-of-network services in an emergency or for ancillary services such as anesthesia and radiology that they didn’t know were outside their insurance plans. Out-of-network care is usually more expensive than in-network with higher coinsurance rates or no coverage at all.

“For two years, TeamHealth and our 16,000 front-line medical professionals have urged Congress to protect patients from surprise medical bills and preserve their access to critical care,” Chief Executive Leif Murphy said in a statement. “This agreement is good for patients and avoids unfair leverage for insurers that would have shred our health-care safety net in the midst of a pandemic.”

Murphy congratulated the bill’s champions, which included House Ways and Means Chairman Richard Neal, a Massachusetts Democrat. Neal favored arbitration for hospitals and doctors, putting him squarely on the side of the private equity-backed companies, and taking criticism for that from Alex Morse, his opponent in this year’s Democratic primary.

Neal stuck to his demands, almost killing the chances of legislation passing this year, according to people familiar with the negotiations. In the end, his unwillingness to bend left TeamHealth and Envision on even stronger footing than they had expected, the people said.

The breakthrough came after House Speaker Nancy Pelosi persuaded Neal and U.S. Senator Lamar Alexander to resolve their differences, according to an aide for the House Ways and Means Committee. Alexander, a Tennessee Republican, opposed arbitration in favor of allowing government rate-setting.

“The approach passed into law is much better for providers than previous compromises and proposals,” Joseph Mercer, an analyst at Marwood Group Research, wrote in a report Tuesday. “However, given a new, untested arbitration process and the reliance on negotiations rather than a set rate, there is some uncertainty as to how the law will work in practice.”