When Bank of America agreed to buy Countrywide Financial for $4 billion in January 2008, the bank's chief executive, Kenneth D. Lewis, called it a "one-time opportunity." When this opportunity knocked, however, it blew the door down. More than two years after the acquisition, Bank of America has taken write-offs of $5.5 billion because of troubles at Countrywide. And the losses are still mounting. Now, instead of celebrating its improved profits and stronger capital base, the bank is trapped in a "Groundhog Day"-style routine of fending off crisis. Bank of America has set aside billions of dollars more to clean up Countrywide's mortgage mess, including an avalanche of new disputes about faulty paperwork and foreclosures - and some analysts say it won't be enough. It has thrown 20,000 employees - the equivalent of two Army divisions - at the job of dealing with the delinquent mortgages. Most of those are the legacy of Countrywide, which originated 10 million of the 14 million loans Bank of America is managing. That legacy is a burden not only for Bank of America but for the entire country. Countrywide's bad mortgages are clogging the U.S. housing market, dragging down home values and slowing the recovery. Moreover, the Countrywide mess has tarnished Bank of America's reputation and put it back at the feet of the government not a year after it repaid its $45 billion federal bailout with interest. No bailout is needed this time, but federal agencies - as regulators and holders of vast amounts of mortgage securities - can either ease or ratchet up pressure on the bank to find a solution.  For the foreseeable future, the morass at Countrywide has also put an end to the freewheeling acquisition strategy that made the Charlotte-based bank the biggest in the United States. "Countrywide was a garbage bin," said Richard X. Bove, a banking analyst with Rochdale Securities. "All they did was make loans they could to whomever they could at whatever rate they could. If Bank of America hadn't made this acquisition, they would have problems, but nothing remotely close to what they have now." "I think they're just going to rue the day they bought Countrywide," said the chief strategist of a major asset management firm who spoke on the condition of anonymity. "That was just a train wreck." To Bank of America executives, however, Countrywide was a good investment that will pay off, albeit more slowly than expected. The acquisition satisfied two key goals, according to Barbara J. Desoer, president of Bank of America's home loan unit. It boosted the bank's share of the U.S. mortgage market and expanded its offerings for customers. Building that business from within would have been time-consuming and expensive. "For our customer base, their needs were broader than what we had to deliver," Desoer said in a conference room in the Willard tower, half a block from the Treasury. "We had a gap. Countrywide was an opportunity . . . to close that gap by acquiring a large retail network." The purchase catapulted Bank of America from a distant sixth place to No. 1 in mortgage originations.