(Reuters) - Warren Buffett's company will become the biggest shareholder in Bank of America Corp BAC.N, after Berkshire Hathaway Inc BRKa.N on Friday invoked its right to acquire 700 million shares of the second-largest U.S. bank.

Berkshire will take a roughly 7 percent ownership stake, worth about $17 billion based on Bank of America’s closing price of $24.32 on Thursday.

The transaction will make Bank of America one of Berkshire's largest equity investments, joining Apple Inc AAPL.O, Coca-Cola Co KO.N, Kraft Heinz Co KHC.O and Wells Fargo & Co WFC.N, the nation's third-largest bank.

It was made possible by Bank of America’s June 28 decision to boost its quarterly dividend to 12 cents per share from 7.5 cents, after passing the Federal Reserve’s latest “stress test” of its capacity to weather difficult markets.

Shares of Bank of America were up 16 cents at $24.48 in early trading on Friday.

Berkshire will exercise warrants to acquire the 700 million common shares when Charlotte, North Carolina-based Bank of America increases its dividend, expected in the third quarter.

It will swap the $5 billion of Bank of America preferred shares it bought in August 2011 for the common stock, in a cash-free exchange.

Slideshow ( 2 images )

Berkshire is sitting on a roughly $12 billion paper profit, because Bank of America’s stock price is more than triple the $7.14 exercise price for the warrants.

After the swap is completed, Buffett will begin collecting $336 million of annual dividends, more than the $300 million he gets from the preferred shares, which have a 6 percent dividend.

Berkshire is also the largest shareholder in Wells Fargo, which sends Buffett close to $800 million of annual dividends.

The billionaire investor’s Omaha, Nebraska-based conglomerate also owns more than 90 businesses such as the Geico car insurer, Dairy Queen ice cream and BNSF railroad.

Brian Moynihan, Bank of America’s chief executive, accepted Buffett’s investment when many investors worried whether the lender would have enough capital.

The bank was only about midway through a multi-year process to clean up its balance sheet, litigation and regulatory probes, largely from its purchases of Countrywide Financial Corp and Merrill Lynch & Co. That process cost more than $70 billion.

Buffett has often praised Moynihan’s leadership, telling CNBC in September 2015 that Moynihan resuscitated a bank that had been a “terrible mess.”

Bank of America’s current largest shareholder is Vanguard Group, whose 652.4 million shares give it a 6.6 percent stake, Reuters data show.