The Affordable Care Act
Put simply, the U. S. Government has very limited powers. Originally the U. S. Constitution allowed the government broad powers due to ambiguity - "to pay the Debts and provide for the common Defence and general Welfare of the United States". On Dec 15, 1791, the Bill of Rights was ratified, limiting the U. S. Government's powers:
"The powers not delegated to the United States by the Constitution, nor prohibited by it to the States, are reserved to the States respectively, or to the people". Amendment 10 - ratified December 15, 1791
The Patient Protection Affordable Care Act
Article 1, Section 8 delegates specific powers to the U. S. Government, universal healthcare is not included. The 10th Amendment places limits on Congressional authority. Only the states have the power to enact healthcare legislation. Once healthcare law has been enacted, the U. S. Government can "regulate Commerce with foreign Nations, and among the several States". U. S. Constitution Article 1, Section 8
The ACA Supreme Court Decision
The U S Supreme Court based it's decision in part on precedent set by previous courts. The Supreme Court is the highest court in the country, charged with applying the Constitution to legal issues. They have an obligation to quote the Constitution, not previous court decisions. Precedent is not mentioned in the U S Constitution, it is simply a concept we accept because we've been told it's valid. They also quoted Article 1, Section 8, Clause 1 - "to pay the Debts and provide for the common Defence and general Welfare of the United States". This clause effectively gives Congress unlimited power, as long as they can argue a law "provides for the general welfare of the United States". But the 10th Amendment amended all clauses in the Constitution regarding Congressional power - it imited Congressional authority to only those powers specifically delegated to it in the Constitution.
Although universal healthcare is a good concept, the U. S. Congress does not have authority to enact it. That power is reserved for the state legislatures or the people.