HCA Holdings stock rose 8 percent, and Community Health Systems stock also rose 8 percent.
Stocks of big insurance companies dropped sharply when the ruling came out shortly after 10 a.m. EDT, then climbed back somewhat. They were down about 1 percent, roughly the same as stocks in the broader market.
Stocks of drug companies and medical device makers were also slightly lower.
Chief Justice John Roberts announced the court’s judgment, which allowed the law to go forward with its aim of covering more than 30 million uninsured Americans.