Berkshire Hathaway will invest $5 billion in troubled Bank of America (BAC). The Omaha-based firm, run by investment legend Warren Buffett, will purchase 50,000 shares in preferred stock at $100,000 per share. Berkshire will also receive warrants to purchase 700 million shares of BofA common stock at an exercise price of $7.14 per share. BofA said Berkshire can elect to purchase all of the shares at once or in part at any time over the next 10 years. The preferred stock and warrants will total $5 billion in capital to the bank. How badly BofA needed the capital remains a question. Speculators sheared the stock value in half since the start of the year, dropping it below $7 per share on claims the bank is more exposed to mortgage, litigation and Europe problems than it was reporting. The bank rejected those claims aggressively. In early morning trading Thursday, BofA stock jumped more than 20%. "We are building the best franchise in financial services and we have laid out a clear plan to deliver long-term shareholder value," Bank of America CEO Brian Moynihan said. "I remain confident that we have the capital and liquidity we need to run our business. At the same time, I also recognize that a large investment by Warren Buffett is a strong endorsement in our vision and our strategy." Buffett said he reached out to Moynihan in recent weeks to provide his confidence the bank will put its problems behind it. "Bank of America is a strong, well-led company, and I called Brian to tell him I wanted to invest in it," Buffett said. "I am impressed with the profit-generating abilities of this franchise, and that they are acting aggressively to put their challenges behind them. Bank of America is focused on their customers and on serving them well. That's what customers want, and that's the company's strategy." Write to Jon Prior. Follow him on Twitter @JonAPrior