Troy-based Flagstar Bank is to be purchased by a New York bank in a tentative $2.6 billion deal announced Monday. New York Community Bancorp plans to acquire Flagstar in the all-stock deal, which, pending shareholder and regulatory approvals, is expected to close by year's end. Troy would become NYCB's regional headquarters, with the bank's primary headquarters on Long Island in New York. The Flagstar Bank brand name would survive, and the newly combined entity would have 394 traditional bank branches in nine states — 236 NYCB branches and 158 Flagstar branches — and 87 mortgage lending offices in 28 states. It would have a total $87 billion in assets. The new NYCB board of directors would have 12 members: eight from legacy NYBC, four from Flagstar.