Mercantile Bankshares Corp. will pay $500 million for a Frederick bank in the latest deal in a wave of high-price bank mergers in the region.

Baltimore-based Mercantile agreed to pay $46 a share for F&M Bancorp, 48 percent more than F&M's closing price Wednesday. Mercantile said the cost is worthwhile to expand its reach into western Maryland, where competition from the multi-state giants isn't as ferocious as in the deposit-rich suburbs of Baltimore and Washington. The price is in line with similar banking acquisitions recently, said Harry Terris, a banking analyst at SNL Financial in Charlottesville.

"This is a great fit with us geographically," said Mercantile chief executive Edward J. Kelly III. "It's easy to overstate the 48 percent market premium."

After Mercantile buys F&M, only Bank of America Corp. will have more deposits and a higher market share in Maryland than Mercantile.

F&M Bancorp is the holding company for Farmers & Mechanics Bank, founded in 1817. It has 48 branches from Frederick to the Cumberland Gap and is Maryland's fifth-largest bank, with $2 billion in assets. Mercantile and its affiliate banks have 185 branches in central and eastern Maryland and $11 billion in assets.

"They see this as a way of fleshing out their branch network in the parts of the state where they're not as strong," said Gary B. Townsend, a banking analyst at Friedman, Billings, Ramsey & Co. in Arlington. "They will really have excellent coverage in Maryland at the end of this."

The F&M Bancorp name won't disappear because Mercantile retains the names of community banks it acquires. Mercantile affiliate banks are also mostly run on a local level.

"Generally it's viewed as a somewhat more expensive way to run a community bank operation," Townsend said of Mercantile's management structure. "But Mercantile has been generally able to do it well."

F&M president and chief executive Faye E. Cannon and Kelly will head the team that integrates the two banks, but her role after the merger has not been determined, a Mercantile official said. Cannon could not be reached for comment.

Most of F&M's branches will be combined with those of Fredericktown Bank, Mercantile's Frederick-based bank, and operate under the F&M name. Other branches will be merged into Mercantile affiliates Westminster Union Bank, Citizens National Bank and Potomac Valley Bank. About 21 branches will be closed because of the merger, both F&M and Mercantile offices.

"The branch closings will be relatively equally distributed," Kelly said. "We're going to pick and choose those branches that make the most sense, irrespective of what flag they're under."

F&M has about 750 employees and Mercantile about 2,900. Sources at Mercantile said 250 jobs probably will be eliminated between the companies.

Mercantile's $46-a-share offer is cash, stock or a combination, depending on what individual shareholders want. Shares in F&M rose $11.49 yesterday to close at $42.49, up 37 percent. Mercantile shares fell $1.46 yesterday to $32.75.

Kelly, a former investment banker, was appointed Mercantile's chief executive two years ago and began to focus on the bank's underdeveloped asset-management business. He expanded the bank's money-management staff and recently went on a buying spree, snapping up three other money managers and a Baltimore discount brokerage. The F&M purchase is Mercantile's first bank acquisition since Kelly's appointment.