Stocks of hospital companies rose sharply and insurance companies fell after the Supreme Court upheld a requirement that almost all Americans carry health insurance.