Like other nasty Supreme Court decisions of the past, this one was made based not on the Constitution, but on the political predilections of the judges. Most obviously, in Dred Scott, Chief Justice Roger Taney thought that by ruling that slavery could not be prohibited in federal territories, he would be preventing Civil War; instead, he precipitated it.
Taney's machinations -- his political considerations in his decision making -- were clearly above and beyond the duties of the court. But he undertook them anyway. The result was the greatest moral blot on the history of the Supreme Court.
There is no doubt that the same sort of logic went into Chief Justice Roberts' thinking. He apparently switched his vote on Obamacare after feeling pressure from the Obama administration and the media; he decided that he'd simply toss the issue to voters rather than doing his constitutional job. His goal was the preservation of the Supreme Court's "legitimacy" -- a goal undermined by his own illegitimate decision making. Politics mattered more to Roberts than duty.
And so, Americans pay with their rights.
In the end, all of the mistakes of the Supreme Court were overturned -- after far too long -- by the will of the American people. Dred Scott was overturned by the Civil War; Plessy was overturned not truly by Brown v. Board, but by the Civil Rights Act of 1964. The people themselves will overturn Obamacare. But the damage done to the Supreme Court cannot be undone.