1. Congress has the right to force citizens to enter into commerce, under the commerce clause -- the mandate penalty was just that, a penalty.
2. Congress has the right to tax any behavior it sees fit -- the mandate penalty was, for this purpose, a tax.
SCOTUS rejected the first claim (proving that they do see limits to the commerce clause sometimes), and accepted the second claim. SCOTUS did not create the idea that it was the mandate was a new tax -- the government did.