The Supreme Court ruling Thursday is the second time Chief Justice John Roberts and Associate Justice Antonin Scalia have squared off on President Obama's health-care reform law. The chief justice wrote the decision upholding the law the first time it came before the court in 2012, and Scalia dissented.

Roberts used the dissent's own words against Scalia in the case decided this week, which focused on what Congress was trying to do when it passed the Affordable Care Act, generally known as Obamacare.

The main question in the case is about the subsidies used to buy health insurance by people who otherwise can't afford it. Roberts and Scalia disagree on whether Congress meant for the subsidies to be available through the federally run insurance marketplace set up under the law, as the Obama administration argued, or if Congress wanted to give subsidies only to people who bought insurance through an exchange operated by a state government, as the law's opponents claimed.

Roberts agreed with the administration. He wrote that it was "implausible" for Congress to set up a system in which people who used the federal marketplace wouldn't be able to get financial help buying insurance. Scalia disagreed. But, back in 2012, he had written that without subsidies, "the exchanges would not operate as Congress intended."

At that time, Scalia had been arguing that the main elements of the law -- requiring most Americans to buy health insurance and expanding Medicaid to a larger number of beneficiaries -- were unconstitutional. He wanted to show why the court couldn't just throw out the parts he saw as unconstitutional, but would have to strike down the entire law.

Without these provisions, Scalia noted, premiums would be much more expensive, since the healthiest consumers -- who are the most profitable for the insurance industry -- would choose not to buy policies. The federal subsidies intended to make insurance affordable would have to be larger, and Scalia argued that the court didn't have the authority to insist that the government spend far more money than Congress had intended.

And without those subsidies, Scalia went on to write, the marketplaces or exchanges set up under the law wouldn't function -- exactly the argument the Obama administration made in the most recent case.

On Thursday, Roberts took that language and used it to defend his argument that the subsidies must be upheld.

In some states, policymakers have not established their own marketplaces, and instead have sent residents to the one operated by the federal government. The Affordable Care Act says Americans can get a subsidy if they buy insurance through a marketplace "established by the State," which the law's opponents argued excludes those who bought their insurance through the federal system.

Without the subsidies, the insurance markets in states without their own exchanges would have collapsed. Premiums would have roughly quadrupled for an estimated 6.4 million people, many of whom would have likely canceled their plans.

The administration argued that since Obama and Democrats in Congress were trying to extend coverage to as many people as possible, an interpretation of the law that denied subsidies to all those people simply didn't make sense. The phrase "established by the State," they said, was simply a drafting error that no one noticed for years.

Roberts and the majority of the justices agreed.

"It is implausible that Congress meant the Act to operate in this manner," he wrote, and then he cited Scalia's words from a few years ago.

It's not the first time a dissent by Scalia has been used to support a view he opposes. His dissent against gay marriage has been widely cited by lower courts arguing that bans on same-sex unions are unconstitutional. Another major decision on gay marriage is expected from the Supreme Court in the next few days.