We can finally put months of speculation surrounding the fate of troubled mortgage lender Countrywide Financial (NYSE: CFC) to rest. Bankruptcy is out, but so is a much-desired rebound.

After one of the most volatile weeks Countrywide's stock has ever had, Bank of America (NYSE: BAC) agreed to purchase it for around $4 billion, or around 90% less than its 52-week high of $45 per share. Bank of America agreed to issue 0.1822 shares of stock for each share of Countrywide, in a deal expected to close in the third quarter of this year.

You're making my head spin
Investors who feared a total collapse of Countrywide might be able to breathe a much-needed sigh of relief, but there will be a shortage of smiles going around. After rumors of preliminary talks broke on Thursday, Countrywide stock rallied by more than 50%, only to shed 16% Friday morning as the terms of the deal ended up far below what investors had expected.

In a sign that shows the deal was done more out of desperation than opportunity, Countrywide is being sold fully 20% lower than it traded just at the start of the year. I'm willing to bet Countrywide CEO Angelo Mozillo didn't have that in mind when making his new year's resolutions.

Send in the reinforcements
What lies behind Bank of America's timing? Some speculate that it could have been more of a last option on the table, after Bank of America's $2 billion injection last August lost the majority of its value. In what at the time looked like a bargain purchase, the plummeting real estate market was only beginning to show its ugly side back then, when B of A hopped aboard.

As the deteriorating market continued to whittle Countrywide down to scraps so thin that hungry vultures would have looked the other way, and as bankruptcy rumors spread as recently as two days ago, Bank of America indeed may have chosen to purchase the entire company and take on the risk of its loan portfolio rather than leave the company's fate up to the whims of the market.

A complete collapse of Countrywide could have sent shock waves through the financial world and caused a substantial blow to the economy. Avoiding that might have been reason enough for Bank of America to act. A market without Countrywide would have placed mortgage giants Freddie Mac (NYSE: FRE) and Fannie Mae (NYSE: FNM) in precarious positions, because they relied heavily on Countrywide to feed them mortgage loans.

We don't know whether Bank of America saw the opportunity as strategic or a chance to plug the industry's leaking arteries. Investors will no doubt keep a close eye on how this deal works out. Whether it will pay off for Bank of America is certainly no sure bet.

With a slew of adjustable-rate mortgages about to reset this year, monthly mortgage payments around the country will increase and put homeowners at a high risk of foreclosure. For that reason, few observers believe the mortgage industry will recover any time soon.

Nonetheless, taking on Countrywide now makes Bank of America the nation's largest mortgage lender and loan servicer. With more than $1.5 trillion in assets and easy access to cheap cash through customer deposits, Bank of America might be the saving grace that pushes Countrywide back into its dominant stride.

No doubt about it: The purchase price is a mere fraction of Countrywide's book value and places it at just 1.5 times 2006 net income. If Bank of America can integrate the company successfully into its business model once the real estate market gets back on its feet, huge payoffs may lie down the road.

But can Bank of America keep Countrywide's increasingly ugly portfolio of loans alive long enough to weather the storm?

The end of the beginning of the end?
For investors on all sides of the financial-services industry, the saga continues. Everyone from Citigroup (NYSE: C) to Bear Stearns (NYSE: BSC) was hit one way or another by the deteriorating debt markets, and the once resilient and seemingly bulletproof business models now face increasing setbacks. As more and more financial players -- including hedge funds and pension funds -- continue to struggle, their ability to help one another by keeping the debt markets liquid and active is faltering.

Bank of America's purchase of Countrywide by no means marks an end to this story. If anything, it might only be a sign of how distressed the industry is in one of the weakest real estate markets the nation has ever seen.

For related Foolishness: