The main purpose of the Affordable Care Act (ACA) was to provide health insurance for most of the tens of millions of Americans who don't currently have any coverage. But after an impossible-to-predict move from the Supreme Court seemed to gut the law's ability to do that, millions of people will instead get coverage through a drafting error that was never supposed to become law.

Here's the mistake: Under the ACA, Americans with an income below 138 percent of the federal poverty level qualify for Medicaid, the public low-income insurance program, starting in 2014. But at the same time, Americans with an income of 100 percent of the federal poverty level and above (up to 400 percent) qualify for federal tax subsidies to purchase private insurance on the health insurance marketplaces created by the law, which also open in 2014. Those are the two main ways that uninsured people are supposed to get health coverage under the law.

The ACA stipulates that an individual can't qualify for both Medicaid and a tax subsidy (as people between 100 and 138 percent of the federal poverty level technically would). To address that gap, the ACA said that anyone who qualifies for both would just automatically be enrolled in Medicaid. So why don't the thresholds simply meet at 138 percent? Well, they were supposed to, but because of an oversight while the bill was being amended in the Senate, they don't.

But it didn't matter as long as the Medicaid expansion was mandatory, which it was always supposed to be. But then the Supreme Court ruled last June that the expansion wasn't required -- states could choose whether or not to expand Medicaid eligibility to 138 percent of the poverty line. That's an outcome no one saw coming, not even the people who wrote the law.

By making the Medicaid expansion optional, the Court exposed this obscure mistake that had been buried in 906 pages of legislation. And it created a huge loophole: In states that aren't expanding Medicaid, those "in-betweeners" -- residents who make between 100 and 138 percent of the poverty line -- will now qualify for tax subsidies to buy private insurance instead.

“It was unintentional," said one person who was involved in drafting the bill in the Senate. Like other sources interviewed for this story, this person spoke on condition of anonymity in order to speak candidly about the error and private deliberations around the ACA. "This strange confluence of events got us here. Nobody thought the Supreme Court would rule as it did,” the source said. “If the Medicaid expansion had occurred as we wrote it, then this wouldn’t have mattered. The number of turns in the plot was hard to anticipate.”

That little quirk in the law will have a major impact. Nationwide, more than six million uninsured people fall in the critical 100-138 percent income range, between $11,490 and $15,856 for an individual. Right now, 13 states have said they won't expand Medicaid, including large states like Texas and Pennsylvania. More than 2 million residents in those states are 'in-betweeners' and will be affected by the ACA error. Several other big states -- including Florida*, New Jersey and Virginia -- are still on the fence. If those places opt against expanding Medicaid, the number of those impacted could grow by another several hundred thousand.

The bottom line is this: Thanks to an oversight four years ago on Capitol Hill, every one of those 2 million-plus people will be able to use federal tax subsidies next year to buy private health insurance.

How the Mistake Happened

Back in 2009, early versions of the Senate’s health reform bill included what was known as a Bridge Policy: people between 100 percent and 138 percent of the federal poverty level could choose whether they wanted to enroll in Medicaid or go through the marketplaces and purchase private insurance with a federal tax subsidy. That’s why the Medicaid threshold was capped at 138 percent, and the tax subsidy threshold initially started at 100 percent. (A sidenote: The ACA officially sets Medicaid eligibility at 133 percent of the federal poverty level. But the statute also allows for wiggle room of 5 percent, up to 138 percent, and that is the threshold that will be used for Medicaid enrollment in 2014.)

Sources said the policy was offered as an olive branch to Republicans, who were wary of the government-run Medicaid program growing too large. The GOP preferred funneling more people to private insurance. An early iteration of the Bridge Policy was present in policy options submitted jointly by Sen. Max Baucus and Sen. Chuck Grassley to the Senate Finance Committee in May 2009. The policy in its final form (with the 100 and 138 percent thresholds) was part of the bill approved by the committee on Oct. 13, 2009.

But it was also more expensive for the federal government. Medicaid, which is funded jointly by the states, costs Uncle Sam less than the tax subsidies, which are fully funded by the feds. So it would be cheaper to just enroll everyone below 138 percent of the federal poverty level in Medicaid, rather than give them a choice. And that’s why the Bridge Policy was ultimately discarded: The authors wanted to keep the ACA’s price tag down.

When the Congressional Budget Office (CBO) came back with estimates of the bill’s costs, Senate staff decided the Bridge Policy was too costly to keep in the bill. No one can say for certain what the exact cost would have been, and the CBO analysis of the Bridge Policy was never released publicly. One source recalled that the Bridge Policy would have cost the federal government an additional $50 billion over 10 years. Another said that number was “too high,” but acknowledged that the costs were in the billions.

So the Bridge Policy was eliminated when the Finance Committee bill merged with the health reform bill from the Health, Labor, Education and Pensions committee, one source said. That merged bill was sent to the Senate floor. Instead, the Medicaid expansion was supposed to cover everyone below 138 percent of the federal poverty level, while the tax subsides were intended to cover everyone above that. A manager’s amendment reworked much of the ACA’s language, incorporating changes to nearly every section of the bill from the floor debate and accompanying backroom negotiations. That’s the bill that was passed by the Senate on Dec. 24, 2009.

But the tax subsidy threshold was never revised from 100 to 138 percent after the Bridge Policy had been removed, as it logically should have been. That was an unintentional oversight, said sources who spoke with Governing. How did they miss it while the bill was being rewritten? It appears to be as simple as this: The Bridge Policy and the tax subsidy section of the Senate Finance bill are separated by more than 100 pages. When one section was changed, nobody remembered to check the other.

“I don’t want to imply that people were being sloppy. But when you take out the Bridge Policy, you’ve got to check in 20 different places to make sure everything matches,” one Senate staffer said. “This stuff was happening so quickly, and, at the end, it was quite messy.”

The messiness of the ACA's final days in Congress are well known. It was complicated after Democrats lost a seat in the Senate in January 2010 when Republican Scott Brown was elected in the Massachusetts special election to fill Ted Kennedy’s seat. Brown’s commitment to filibuster a conference bill, which would have reconciled differences between the Senate and House bills, meant that Democrats in the Senate couldn't pass revised legislation as they traditionally would.

Instead, the Senate bill was passed as-is by the House on Feb. 25, 2010. That legislation was signed by the president on March 23, 2010, with the mistake still intact. The House then passed a separate bill that amended some of the ACA's language, but didn't address the discrepancy between the Medicaid and tax subsidy thresholds. It's possible they couldn't be changed because of procedural rules, one source said. Regardless, the Senate passed the latter bill on March 25, 2010, and Obama signed it five days later.

Even then, the error shouldn't have mattered. As long as the Medicaid expansion was mandatory, the in-betweeners would simply be enrolled into Medicaid. But the Supreme Court's decision last June changed that.

"A Happy Coincidence"

The irony here is that the mistake actually edges the ACA a little closer to its initial goal of universal health coverage -- as one Senate staffer called it, it's “a happy coincidence.” But no one could have predicted that outcome -- not the authors, not the bill's opponents, not independent legal analysts. (As one source explained, if the goal had been to create a fallback Plan B in case the Medicaid expansion was completely tossed by the Court, the bill's authors would have set the tax subsidy threshold at 0 percent of the federal poverty level rather than 100 percent, so that everybody would be covered.)

The statutory error, paired with the Supreme Court decision that made it matter, will also force the feds to spend their ACA dollars a little differently. A CBO analysis after the Supreme Court decision estimated that the federal government would spend an additional $210 billion on tax subsidies by 2022, although those costs were offset by $289 billion in savings on Medicaid.

But the law's authors chose to focus on the upside. Depending on how many states don't expand Medicaid, as many as 3 million Americans will still get health coverage thanks to what seems to have been an honest mistake.

“It didn’t really matter until June," said one Senate staffer. "Then we all said, ‘Wait a second. What about that leftover thing from the Bridge Policy?’ So I guess you could say it was fortuitous or lucky.”

*Since the initial publication of this post, Florida Gov. Rick Scott has endorsed the Medicaid expansion in his state.