NEW YORK (CNNMoney.com) -- Bank of America has received another $20 billion from the federal government's bailout fund, along with guarantees on $118 billion of assets at the bank, to absorb its recent purchase of the ailing Merrill Lynch.

Details of the deal were announced by the government in the early hours of Friday.

The new arrangement provides additional capital for Bank of America (BAC, Fortune 500) in exchange for preferred stock with an 8% dividend, according to a joint statement by the Treasury Department and the Federal Reserve.

The Treasury will extend $20 billion more to the bank under the $700 billion Troubled Asset Relief Program. The funding will come from the TARP Targeted Investment Program, not the subset $250 billion Capital Investment Program designed to prop up healthy banks' balance sheets.

The bailout deal also provides a $118 billion backstop from the Fed in case of "unusually large losses" on assets backed by real-estate loans, most of which are being absorbed by Bank of America in its buyout of brokerage house Merrill Lynch. Bank of America will pay 3.7% of those assets as a fee for the backstop, and is responsible for the first $10 billion of losses and 10% of the remaining losses.

According to Ken Lewis, Bank of America's chief executive, Bank of America realized soon after its merger deal with Merrill Lynch in mid-September that Merrill's losses were accelerating beyond expectations. In December, the bank discovered Merrill's asset deterioration was "much, much higher" than anyone had forecast.

But when the bank considered renegotiating the deal, the Treasury Department intervened.

"As we saw the anticipated loss accelerating, we reevaluated our rights under the deal," Lewis said on a conference call with investors. "The government was under the view that walking away would cause significant concerns and serious systemic harm to the financial markets."

Lewis said the government's response led to considerable uncertainty about its next steps, but in the end, he concluded that sticking with the deal would best benefit the national economy.

"We did think we were doing the right thing for the country," Lewis said.

Huge quarterly losses

The news came just before the nation's largest bank reported a net loss of $1.79 billion in the fourth quarter of 2008, compared to earnings of $268 million at the same period in 2007.

The net loss to common shareholders, including the issuance of preferred stock dividends that the government receives from its preliminary capital investment, was $2.39 billion, or 48 cents per share. Analysts expected earnings of 8 cents per share.

The loss did not include Merrill Lynch's results. The recently acquired investment bank reported a loss of $15.31 billion, or $9.62 per share. Bank of America cited "severe capital markets dislocations" for Merrill's huge loss, especially late in the quarter.

"The acquisition of [Merrill Lynch] significantly increases [Bank of America's] exposure to currently depressed capital markets-related revenues," wrote Jeff Harte, analyst with Sandler O'Neill & Partners, in a note.

Citing escalating credit costs, significant writedowns, trading losses and a deep economic recession, Bank of America slashed its dividend from 32 cents a share to just a penny. The bank had already cut its dividend in half in the previous quarter.

"These are extraordinary times," said Lewis. "The credit markets literally hit a wall, and nobody lending to consumers or who is in the capital markets is immune."

Third bailout's a charm

Bank of America has now received a total of $45 billion in government aid. Before the latest injection, it had been the recipient of $15 billion in government capital in October, and $10 billion last Friday - an investment that had been set aside for Merrill Lynch.

The deal marks the second time the federal government has had to step in again to prop up a faltering financial institution. In November, officials injected another $20 billion into Citigroup (C, Fortune 500), which had already received $25 billion, and agreed to backstop more than $300 billion in troubled assets.

Aimed at fostering stability in the financial system, the $20 billion lifeline should be transferred to Bank of America later Friday, according to a senior government official.

Banks receiving TARP funds have been criticized for hoarding the cash to raise capital ratios, rather than lending it to improve the credit situation.

"Legislators raised concerns that we're pulling back on credit," Lewis said. "It is true, our appetite on credit risk is greatly reduced. How could it be otherwise?"

Still, Lewis noted that the bank originated $115 billion in new credit in the fourth quarter, including many new home loans. The bank said demand for mortgages surged in late December as loan rates fell.

Bank of America's shares fell 14% in afternoon trading after dropping 18.4% Thursday. They have fallen 45% so far this week on concerns that the bank -- which had been viewed as one of the strongest in the country -- may be buckling as the nation's economy worsens.

The Charlotte, N.C.-based bank has also taken over two ailing companies that thrust it deeper into the most troubled sectors of the financial system. Not only did it take a big gamble on its $24 billion acquisition of the faltering brokerage titan, but it also bought battered mortgage lender Countrywide Financial early last year.

Bank of America already has announced it plans to shed up to 35,000 jobs over the next three years as it integrates the Wall Street firm. Chief Executive Ken Lewis gave up his 2008 bonus last week.

More to come?

Officials didn't disclose whether other troubled banks would need similar assistance. "Each time we do one of these, we hope it's the last one we will ever have to do," one official said.

Bank earnings this quarter have been dismal so far. Citigroup reported a whopping loss Friday, while JPMorgan Chase (JPM, Fortune 500) said its profits plummeted 76% Thursday.

The Treasury Department has less than $60 billion left to inject into banks under its capital purchase program. President-elect Barack Obama on Thursday secured access to the $350 billion remaining in the federal bailout package, after a measure that would have blocked the funds' release failed in the Senate.

Some analysts say banks are likely to get additional capital infusions this year. Federal Reserve Chairman Ben Bernanke said Tuesday that the government must pump more money into troubled financial institutions and that further guarantees of their debt could be necessary.

-- CNN's Scott Spoerry contributed to this report.