Some stocks performed well in 2016 due to Obamacare, but they did so not because of successes for the health reform legislation.

Several stocks scored solid gains this year partially as a result of Obamacare. However, those gains came in large part from expected benefits from the potential unraveling of the Affordable Care Act. Here's why HealthEquity (HQY -0.50%), UnitedHealth Group (UNH 2.15%), and St. Jude Medical (STJ) stand out as three of the best Obamacare stocks of 2016.

Image source: Getty Images.

A leader in health savings accounts

HealthEquity is probably the biggest Obamacare stock of the year. The company's shares soared over 70% this year, with much of those gains coming after Donald Trump won the U.S. presidential election.

Trump has been adamant that Obamacare be repealed and replaced. The good news for HealthEquity is that health savings accounts (HSAs) are a big component of a potential replacement program. HealthEquity provides a technology platform where consumers can manage their tax-advantaged healthcare savings accounts.

HealthEquity is the integrated HSA platform for 25 of the 50 largest health plans in the U.S. Through its network partners, which includes health plans and employers who are customers of its services, HealthEquity has the potential to reach roughly 39% of Americans under age 65 who are candidates for individual health insurance.

The company was doing well even before the election outcome. HealthEquity's HSA membership jumped 50% year over year in its latest quarter. With HSAs likely to become an important cornerstone of healthcare proposals from the Trump Administration and the Republican congress, HealthEquity seems likely to continue to enjoy robust growth.

Exchanging losses for profits

UnitedHealth Group lost $475 million on Obamacare plans last year and expects to lose another $500 million this year. The giant health insurer's stock, however, has climbed nearly 30% in 2016. Part of the reason for this solid performance was a decision made by UnitedHealth Group to pull out of most of the Obamacare exchanges.

At the beginning of 2016, UnitedHealth participated in the Obamacare exchanges of 34 states. In 2017, the company plans to participate "in only a few individual public exchanges." The move might reduce revenue, but it will improve the insurer's bottom line.

Thanks to its other business, that bottom line already looked pretty good in 2016. During the first nine months of the year, UnitedHealth's earnings grew 16% compared to the prior year period. The company's Optum business segment, which includes pharmacy benefits management (PBM) and technology services, played a big role in that growth.

UnitedHealth Group could also benefit from the repeal of Obamacare. Removal of minimum benefits requirements could allow the company to tailor insurance plans that are more attractive to customers and are more profitable.

Taxes not so certain after all

Benjamin Franklin once said, "In this world nothing can be said to be certain, except death and taxes." For medical device maker St. Jude Medical, the certainty of not incurring Obamacare taxes helped in 2016.

In December 2015, President Obama signed a tax and spending bill that suspended the 2.3% medical device excise tax enacted with Obamacare. This bill put the tax on hold for two years. Of course, should Obamacare be repealed, the tax could be gone forever.

The biggest news for St. Jude in 2016, though, had nothing to do with Obamacare. In April, Abbott Laboratories (ABT -3.03%) announced that it would acquire St. Jude in a $25 billion deal. This sent St. Jude's stock soaring.

Despite the removal of the medical device excise tax, St. Jude Medical made less profit in the first nine months of the year than it did in the prior year period. The decline stemmed from higher spending. Abbott expects the acquisition of St. Jude will improve its bottom line beginning in 2017.

Best chances in the New Year

HealthEquity could do well yet again in 2017. HSAs seem poised to grow in popularity regardless of what happens on the political scene. With a big push for HSAs by the Trump Administration, though, HealthEquity could reap even greater rewards.