Buffett’s Bank of America deal, dreamed up in the tub by Shawn Tully @FortuneMagazine August 29, 2011, 4:34 PM EST E-mail Tweet Facebook Google Plus Linkedin Share icons A lot to smile about. FORTUNE — Early on Wednesday morning, August 24th, Warren Buffett was soaking in the bathtub at his red-brick, white-columned house in Omaha, musing about how he’d made some of his best buys when investors bailed on solid companies suffering a highly-publicized storm. He correctly predicted they’d work through the trouble, and made billions when they recovered. From the tub, Buffett recalled two such occasions. The first was the Great Salad-Oil Scandal. In the early 1960s, a commodities mogul was taking out big loans secured by what he claimed were giant inventories of salad oil stored in warehouses owned by American Express AXP in Bayonne, New Jersey. As it turned out, the tanks contained mostly water, with salad oil floating on the top for disguise. Shares of AmEx dropped 50%. Buffett pounced, and multiplied his investment five-fold in five years. The second crisis-driven opportunity came in 1976, when the stock of GEICO collapsed to $2 a share from a previous high of $61. The once conservative insurer had lost its way by underpricing its policies in pursuit of reckless growth, and scrimping on reserves. Once again, Buffett reckoned that GEICO would thrive if its new management restored its low-cost, low-risk strategy. Berkshire Hathaway brk.a boosted its holdings as others fled, and by 1996 had accumulated 51% of its stock. That year, Berkshire purchased the remaining shares at $71 for $2.3 billion — 35 times what he paid in the crisis, and a price that now looks like a terrific bargain. Thirty-five years later, Buffett thought he saw the same pattern in the big company investors reviled more than any other: Bank of America BAC . Buffett didn’t even have CEO Brian Moynihan’s phone number, and asked his administrative assistant to find it. When he reached Moynihan at the environmentally-friendly Bank of America Tower in midtown Manhattan, Buffett proposed a deal that was relatively light on dividends, and heavy on warrants that would produce enormous gains if BofA recovers. Moynihan, an experienced dealmaker from his days making acquisitions for Fleet, wanted near-total secrecy. He declined to bring in investment bankers, didn’t consult with lieutenants, and initially discussed the deal only with his chairman, former DuPont CEO Chad Holliday. Can Brian Moynihan fix America’s biggest bank? The board voted by phone early Thursday morning. The $5 billion deal had taken just 24 hours, a pace that could only happen in Buffett-land. Berkshire Hathaway will receive a 6% dividend, and the right to buy 700 million shares at a price of $7.14. BofA’s shares are already trading over that level. Fund managers and analysts fear that Bank of America needs to raise lots of additional capital by selling stock, at extremely low prices. They believe the bank lacks the financial strength to cover its big exposure to troubled mortgages. The TV talking heads, disappointed investors, and even investment bankers within BofA who get bonuses in stock and are watching it collapse, take a dim view of its future and Moynihan’s leadership. In the current news cycle, the relentlessly negative tilt about Bank of America now rivals the talk about the European debt crisis. Buffett takes a different view: Berkshire wouldn’t have invested in BofA if it needed his money. The Berkshire chairman reckons that the bank would work through its current problems, and that the underlying banking business will prove highly profitable. It’s interesting that it took a dynamo to pull GEICO out of its ditch — an Irish-American executive named Jack Byrne who combined excellent analytical skills with flamboyant salesmanship who would heave his hat into the headquarter’s atrium every morning and rally the troops like Knute Rockne. The financial press and most of Wall Street thought Byrne would fail, and he proved them wrong. Berkshire’s BofA investment is clearly an endorsement for Moynihan, just as it was a vote for Byrne. And if Moynihan’s claim that BofA will earn as much as $25 billion in a few years proves correct, Berkshire’s profits will exceed $10 billion. It all started with memories of a salad oil scandal that spooked investors half a century ago.