Glenview Capital Management LLC made a bold decision when President Barack Obama’s health-care overhaul was rolling out: Bet on it.

The result has been one of the most successful hedge-fund wagers in recent years. New York-based Glenview has realized and paper gains of more than $3.2 billion since it started making investments in hospitals and insurers four years ago, according to a Wall Street Journal analysis of securities filings.

The fund is run by Larry Robbins, a billionaire hockey fanatic known for his sermonizing investor letters. Its latest win comes courtesy of Anthem Inc., the nation’s second-largest health insurer by revenue, which announced a $48 billion-plus acquisition of rival Cigna Corp. Friday. Glenview owns shares in both companies, as well as in insurers Aetna Inc. and Humana Inc., which struck a $34 billion deal of their own three weeks ago. Shares of all four companies have rallied in anticipation of tie-ups.

The passage of the Affordable Care Act, known as “Obamacare,” has riled executives throughout corporate America over concerns about its costs and deeper government involvement in a key industry. But while the health-care industry, many investors and individuals wrestled with the uncertainties created by the law, which was passed in 2010, a team at Glenview was laying the groundwork for the wager early on.

They reasoned as early as 2007 that the health-care system in the U.S. was likely to change, with more people gaining coverage and mergers in the future for hospital operators and health insurers. They largely stuck to that thesis through two presidential campaigns, a congressional brawl and a pair of cliffhangers at the Supreme Court.