Why New Jersey’s largest bank was forced to sell now by Stephen Gandel @FortuneMagazine August 27, 2012, 9:36 PM EDT E-mail Tweet Facebook Google Plus Linkedin Share icons FORTUNE — For Hudson City Bancorp, the recovery was harder than the recession. On Monday, Hudson HCBK , which is the largest independent bank in New Jersey and one of the few banks in the nation to make money during the financial crisis, agreed to sell out to rival M&T Bank MTB . But Hudson has struggled recently. The bank lost $700 million last year. The deal, which is valued at $3.7 billion, is the biggest bank deal of the year and it was well received by the market. Not only did Hudson’s shares jump on the news of the deal – up nearly 16% to $7.45 on Monday – but so did M&T’s stock, which was up nearly 4% to $89.82. Often acquirer’s shares fall. MORE: Where’s all the government spending going? This time, though, despite Hudson’s recent losses, many analysts and investors appeared to think M&T got a bargain. Hudson has a tangible book value of $4.2 billion, or $500 million more than what M&T is paying to buy the bank. What’s more, Christopher Whalen, senior managing director at Tangent Capital Partners, says Hudson, which has 135 branches and is the 42nd largest bank in the nation, is as pristine as a bank can get. Says Whalen, “If HCBK’s credit book is all that the public data suggests, then MTB is walking away with one of the lowest loss-rate portfolios in the Northeast US and at a discount to book.” But perhaps the most notable aspect of the deal is the swift change in fortunes for Hudson and its executives. In the wake of the financial crisis, Hudson, which specializes in residential mortgage lending, was praised for not lowering its standards during the mid-2000s credit bubble. The bank never made a single sub-prime, option-ARM or any other risky home loan that got so many other banks into trouble. Very few of Hudson’s mortgages ever ended up in default. CNBC called Hudson’s CEO Ronald Hermance the “George Bailey Banker of the Year.” Forbes said Hudson was the best managed bank in the nation. These days, the large banks are making money again in their mortgage operations, as consumers take advantage of low interest rates and refinance their mortgages, which makes Hudson’s recent performance once again a standout. MORE: In stress tests, Fed may have inflated grades for TARP banks Banks have to manage two types of risk – credit risk and interest rate risk. And while Hudson did a great job with the former, it proved less adept at managing falling interest rates. In order to boost its bottom line, Hudson borrowed money from the Federal Home Loan Bank. It then used that money to make home loans or to buy highly-rated mortgage bonds. At its peek, Hudson had $61 billion in loans or securities on its books, and only $25 billion in deposits. Since then mortgage rates have plunged to a recent 3.66%, which is their lowest levels in more than 40 years. Despite the historically low mortgage rates, the big banks are able to make money, because they fund most of their lending with deposits, most of which goes into zero-interest checking accounts. The loans Hudson took out from the FHLB, however, were fixed at rates set back a few years ago, when interest rates were higher. And the bank pledged to borrow the money for a number of years, or else pay steep penalties, which it did twice last year. Nonetheless, Hudson still has as much as $13 billion in loans from the FHLB at interest rates that are now higher than what the bank can make in the mortgage market. MORE: The bond bubble still has room to grow “Hudson was diligent when it came to making sub-prime loans,” says RBC bank analyst Gerard Cassidy. “But it acted like a drunken sailor when it came to leveraging up its own balance sheet.” Hudson apparently contemplated significantly expanding its lending operations, hiring as many as 230 loan officers in the next year, and getting into such businesses as commercial lending where loans tend to have higher interest rates. But the board of one of the most conservative banks in the country balked. And when M&T called, management decided to sell. And while Hudson’s problem may seem unique, they could be a sign of what’s to come. The big problems of the 2008-2009 financial crisis were because banks stopped managing credit risk, i.e. they lent to people who had no ability to pay them back so they could buy houses at ridiculously inflated prices. It didn’t work out well. But that doesn’t mean that will be the problem of the next financial crisis. Right now, it appears, Hudson aside, banks have done a good job managing interest rate risk. But that could change. Lots of banks have piled into Treasury bonds and other investments that will lose money when interest rates rise. Banks say they are able to manage that risk. If not, we could see many more run into the same problems that sunk Hudson.