The logic that saved the individual mandate should have also saved the Medicaid expansion.
Sometimes the Supreme Court (or a majority of it, at least) seems to behave as if it exists in the same universe as rational human beings. Sometimes it doesn't. Today it did both.
On the headline question posed by the Affordable Care Act, the Court--or John Roberts, at least--decided to observe the laws of logic. Discussing the financial penalty that undergirds the individual mandate, he wrote: "Our precedent demonstrates that Congress had the power to impose the exaction in §5000A under the taxing power, and that §5000A need not be read to do more than impose a tax. That is sufficient to sustain it" (p. 39). Statutes should be construed in such a way as to make them constitutional if possible. Since Congress could have justified the law under its taxing power, and since that would have been constitutional, the law is constitutional.*
On the second question, however, Roberts--along with Stephen Breyer and Elena Kagan--lost contact with the realm of ordinary logic. He argued that the Affordable Care Act, by conditioning all state Medicaid funding on the expansion of Medicaid programs to new beneficiaries, is "economic dragooning that leaves the States with no real option but to acquiesce in the Medicaid expansion" (p. 52). (Scalia, Thomas, Kennedy, and Alito thought the whole act should be jettisoned, including the Medicaid expansion.) Therefore, instead of merely "pressuring" states to expand Medicaid coverage, it constitutes "compulsion" (p. 50). The particular problem is the federal government's power to withdraw funding for "existing Medicaid" if states did not provide "new Medicaid."