Your representation of what happened there is misleading — maybe unintentionally. The government may have claimed that it wasn’t a tax in its oral arguments, but by that time they had already submitted hundreds of pages of written briefs that argued many other — often contradictory — points. It’s a tax, it’s not a tax, it might be a tax, it doesnt matter if it’s a tax, etc. You can’t look at the oral arguments as if they are the sum total of all the evidence considered by the court.
https://www.scribd.com/document/98542275/Scotus-opinion
See page 17 et al.
Roberts inverted logic and twisted himself into a pretzel to call the penalty a tax because he thought it should be one.
Scalia in dissent which should have been the majority opinion skewered that idea.
All water under the bridge now...but its a tax because Roberts said so.