Performing at a children's hospital. Source: Flickr, Creative Commons.

If you're interested in healthy gains in an often-overlooked sector, hospitals should be on your radar. Thanks to the expansion of Medicaid and aging baby boomers, hospitals have been seeing their debt levels drop while their admissions and revenues have pumped up.

These are all good trends. Meanwhile, Wall Street analysts have been urging investors to shun hospitals because of worries about an unfavorable ruling on the legality of Obamacare subsidies in the Supreme Court case King v. Burwell. While an unfavorable ruling could cause a short-term dip in the share prices of hospital stocks, I've previously written on why hospitals aren't threatened long-term by this case. In fact, the upside is likely much bigger than the downside, so investors with a little contrarian in their blood will not want to miss this opportunity.

While many investors fear going against the current of common opinion, as Warren Buffet warned, "You pay a very high price in the stock market for a cheery consensus." In other words, if everyone agrees with your investment decision, it's probably not a good one.

The Supreme Court case is keeping the prices of these stocks depressed, opening up opportunities for investors. Here are three stock picks, which all have reasonable market valuations, that should net healthy gains from the improving industry-wide trends.

HCA Holdings (NYSE:HCA): Scale plus solid growth
HCA Holdings lifted full-year guidance in March amid higher admissions and emergency-room visits. Analysts now expect the company to earn $2.2 billion, or $4.95 a share, this year, up 17% over 2014, on a 6% rise in revenue, to $39 billion.

HCA is the largest hospital chain, providing about 5% of all U.S. hospital services. Its superior size gives it a negotiating advantage, keeping costs in check. Cost control is crucial for hospitals. These businesses are extremely capital-intensive, requiring almost constant upgrades to their facilities, not to mention highly expensive equipment.

The company also has a focus on the Sun Belt, giving it a lot of exposure in desirable markets. These include Florida, with its aging population, and cities like Houston and Denver, where employment is strong.

More benefits could lie ahead for HCA. Weak inpatient trends were a nagging concern for the hospital chain in past years. But the company has been strengthening its orthopedic and cardiac services, which attracts doctors, as well as more complex cases that bring in higher revenue, as they require more care.

How big is HCA's earning's risk from an adverse ruling in King v. Burwell? Based on company forecasts, just 6% to 7% of HCA's earnings before interest, tax, depreciation, and amortization are projected to come from Obamacare exchanges.

Meanwhile, in terms of value, HCA has a trailing P/E of 17.3, a PEG of 1.48, and a Price/Sales of 0.88, well below the industry's averages of 19.91 (P/E), 1.88 (PEG), and 1.19 (P/S), respectively. In addition, during the last four quarters, the company has delivered an average positive earnings surprise of 2%.

Finally, HCA has reduced its share count by 18% during the past four years. It has also recently announced plans for another $1 billion buyback that could boost earnings per share by 2%.

LifePoint Health (NASDAQ:LPNT): More volume and less bad debt
Unlike HCA, rural hospital operator LifePoint Health, which recently changed its name from LifePoint Hospitals,didn't raise its outlook last quarter. But Q1 revenues increased 26% over the prior year period, to $1.26 billion. 

"Improved volumes, effective cost management, and the benefits of health-care reform were significant contributors to our results in the first quarter," the company's Chief Executive William Carpenter said. On a same-hospital basis, admissions jumped 17%. Surgeries increased 24.3%, while emergency-room visits were 22.4% higher than the year-earlier period.

LifePoint recently acquired hospitals in Pennsylvania, a state that expanded its Medicaid program a few months ago. The company executives pointed out that LifePoint saw fewer uninsured patients in expanded Medicaid states, with self-pay admissions declining up to 71% in such states.

LifePoint has a forward P/E ratio of 17.6, lower than the industry average. Moreover, the company's Price/Sales is 0.7, also below the industry average of 1.19. In addition to its hospitals, the company owns more than 1,100 physician practices, as well as hospice services, nursing homes, and assisted living facilities.

Community Health (NYSE:CYH): Swinging to a profit
While HCA is the largest chain by revenue, Community Health Systems is the largest by hospital count. The firm swung to a profit in the first quarter as it continued to benefit from its acquisition of Health Management Associates Inc., and from higher admissions and lower uninsured rates.

Community reported that total admissions increased 0.4% in the first quarter. On a same-hospital basis, total admissions rose 2.5%, and net operating revenue rose 5%. While those results aren't electrifying, earnings per share surged a massive 193.1% from the year-ago quarter primarily driven by margin expansion.

Community Health's large base provides both geographical diversification and scale advantages. The company currently operates 200 affiliated hospitals in 29 states, and it is highly leveraged to states in the eastern United States where Medicaid expansion could be the greatest. It also owns a subsidiary, Quorum Health Resources, which offers management and consulting services to nearly 150 hospitals and diversifies Community Heath's revenue stream.

Community Health appears undervalued based on its P/E of 18.9, which compares favorably to its historical valuation -- the company's five-year average P/E is 22.0. The forward P/E is 12.0, in line with expectations that earnings will grow rapidly. Analysts project an average annual rate of 16% earnings growth for the next five years.

Buy when there's blood on the streets
Until the King v. Burwell Supreme Court case is decided, hospital stocks are likely to be volatile. While that can be unsettling, don't forget that the worse things seem in the market, the better the opportunities for profit.

The good news is that, no matter which way the Supreme Court decision goes, you should be in great shape in the long term. Hospitals are strong and growing businesses, and they present good opportunities for investors looking to take advantage of favorable trends in demographics and healthcare reform.