Bank of America Corp. has received a vote of confidence from legendary investor Warren Buffett and sealed an agreement for his company, Berkshire Hathaway Inc., to inject $5 billion into the bank in a private offering.

The move comes as Bank of America has seen its stock slide about 30% this month, while talks have turned this week as to whether or not the firm needs to raise more capital. The bank also moved to quash rumors of a possible merger with JPMorgan Chase on Tuesday.

“We were not seeking to raise, nor do we feel we need to raise additional capital,” Bank of America spokesman Jerry Dubrowski said of the firm Thursday morning. Bank of America had $218 billion in total capital as of the end of the second quarter, amounting to about twice the amount needed to meet current regulatory standards.

Buffett’s decision to invest was initiated by him, he said in a prepared statement, when he called Bank of America Chief Executive Brian Moynihan directly.

“I am impressed with the profit-generating abilities of this franchise, and that they are acting aggressively to put their challenges behind them,” Buffett said. “Bank of America is focused on their customers and serving them well. That’s what customers want, and that’s the company’s strategy.”

Berkshire Hathaway’s investment will consist of the purchase of 50,000 shares of preferred stock with a $100,000 per share liquidation value. The preferred stock will include a dividend at a 6% annual rate, while Bank of America can repurchase the shares at any time at a 5% premium.

In addition, Berkshire Hathaway also has warrants to buy 700 million common stock shares of Bank of America at $7.14 per share.

“I remain confident that we have the capital and liquidity we need to run our business,” Moynihan said in a statement. “At the same time, I also recognize that a large investment by Warren Buffett is a strong endorsement in our vision and our strategy.”