Branches don’t get much love these days, yet almost every bank that decides to unload them has little trouble finding a buyer.

Banks have become increasingly focused on the liabilities side of their balance sheets, investing more time and resources into gaining and retaining deposits. Some banks are in greater need than others.

Flagstar Bancorp in Troy, Mich., is an example of a bank in need of cheap funding. It helped its cause Tuesday, agreeing to buy 52 branches in four states from Wells Fargo. While the move promises to immediately help Flagstar’s balance sheet, it will also test management’s ability to retain the relationships gained from Wells.

Other bankers should take note.

“I think branch acquisitions will be part of the overall consolidation of the industry,” said Tom Hall, CEO of the consulting firm Resurgent Performance. “The largest banks will always be looking to cull the worst 5% to 10% of their branches. … There are opportunities for other good-sized banks to take advantage of that. It makes sense if you have a leverageable brand.”

Flagstar has been reinventing itself since the financial crisis, moving away from a mortgage-heavy strategy to become more commercially focused. It has expanded beyond its home turf in Michigan, buying eight branches in California from East West Bancorp earlier this year.

The deal for the Wells Fargo branches is largely an extension of that effort.

“They’re trying to become more banklike,” said Bose George, an analyst at Keefe, Bruyette & Woods. “The company was more of a mortgage lender with a reasonably large percentage of wholesale funding. This transaction, in terms of what it does for deposits, is a big step in that direction.”

The $17.7 billion-asset Flagstar has relied heavily on borrowings from the Federal Home Loan Bank System to fuel loan growth. Its ratio of net loans to deposits topped 126% at March 31, according to the Federal Deposit Insurance Corp. That number jumps to 143% when comparing net loans against core deposits.

The Wells Fargo branch deal includes $2.3 billion of deposits, which should allow Flagstar to pay off some short-term Home Loan bank advances. Flagstar said it expects Home Loan bank borrowings to fall from 24% of total assets at March 31 to about 12% after the deal closes.

The deal should decrease Flagstar’s overall cost of funds by 21 basis points and increase its non-interest-bearing deposits by 21%. The deposits have an average rate of 0.04%, which is significantly lower than the 0.73% average at Flagstar.

“This is more about transforming the liabilities side of the balance sheet and increasing the number of retail customers the bank has access to,” Alessandro DiNello, Flagstar’s president and CEO, said in an interview. “We’re adding almost 200,000 customers to the company by doing this and that is a very significant change for us.”

It makes sense that Flagstar and other banks would look to reduce funding costs, especially through branch acquisitions, said Michael Iannaccone, vice president at Plexus Financial Services. Compliance costs remain high and loan yields are not rising as fast as many would like. That leaves lowering funding as a way to pad the bottom line.

“I think it could create a real opportunity for banks that are greater than $1 billion of assets,” Iannaccone said. “But they have to ask themselves, is it really worth it to penetrate these smaller markets? It could create enormous opportunity to take someone else’s problem and turn it around because you are more nimble or you have better technology or your profitability requirements are much less than another bank’s.”

Flagstar touted the longer-term benefits of the deal, noting that it increases its retail presence by about 49% and more than doubles its existing banking customer base. Management hopes to expand the platform by adding more retail deposits and lending relationships, especially with small and midsize businesses.

“It is a big change in terms of the opportunity to grow deposits,” DiNello said. “These are sticky customers. They aren’t moving for an extra few basis points offered by another bank.”

Hitting that mark is easier said than done, industry experts said. Management will have to make sure the newly acquired customers stay. Any bank that buys branches from a large institution must provide the service level, technology and functionality that customers had from the seller, Hall said.

“You must proactively retain these customers,” Hall said. “Banks take for granted that deposits will stay, but that isn’t always so.”

Flagstar’s executives said during Tuesday’s call that they expect some attrition. The deposit premium will be paid based on the deposits at the time of closing. Management also said it would apply lessons learned from the East West branch purchase, which closed in March.

While Flagstar may be a familiar name with some customers due to its mortgage lending business, running a branch network requires different skills, Iannaccone said. This deal will require managing a larger number of a people in more markets, integrating different technology and getting new personnel accustomed to its culture.

To Flagstar, the risks are worth the potential payoff. Management is confident that it will be able to keep employees and retain customers given success it has had with previous acquisitions, DiNello said. For instance, DiNello said he wasn’t aware of any employees leaving after its California branch purchase and that Flagstar has seen a growth in deposits from that transaction.

This success starts with communicating with the employees, DiNello said.

“If you understand banking, then you know customers bank with people, not a bank,” he added. “If we can succeed in retaining the employees, then the way they approach their customers [about the transition] will be positive.”