Philadelphia skyline

Jumping Rocks/Getty Images

When it comes to real estate closing costs, location has a huge impact on your wallet.

Philadelphia will put the biggest crack in your budget – nearly $7,000 on a $250,000 home – while St. Louis is the gateway to the cheapest real estate closings among major cities.

What accounts for the difference? Taxes. The most expensive cities charge high taxes for transferring property or getting a mortgage. The least expensive cities don’t.

These are the findings in Bankrate’s 2017 exclusive annual closing costs survey. We took a look at fees in the core cities of the 30 largest metropolitan areas. We conducted the survey by requesting online loan estimates for a $200,000 mortgage for buyers with excellent credit and down payments of 20 percent from up to 10 lenders in each city. And new to the survey this year? Data on transfer and mortgage taxes.

Sounds exciting! Did adding taxes matter?

Glad you asked, because the answer is yes.

The 2016 survey listed Philadelphia as having the lowest closing costs. This year, the inclusion of transfer taxes pushed Philly from the bottom all the way to the top, with the highest closing costs among large cities.

See the average closing costs for the top 30 cities.

The good news? Bargaining is an option

The amount of taxes you’ll have to pay isn’t up for negotiation, but you can bargain over who pays the taxes — the buyer or the seller. You don’t have to follow tradition in a city where the buyer and seller customarily split the taxes. As a buyer, you can ask the seller to pay your customary share, and the seller can ask you to pay the seller’s customary share.

But, keep in mind that it’s a seller’s market in most big cities, so sellers don’t have much incentive to pick up the buyer’s usual share of taxes.

You might have better luck bargaining with the lender.

As a buyer, “I would say ‘I’m not paying for the appraisal fee — you pay it. I’m not paying a $495 processing fee. I’m not paying a $795 underwriting fee. You pay it or I’m going somewhere else,'” says Rick Roque, president of Menlo, a consultancy for builders and mortgage companies. He says this approach works better with nonbank lenders — mortgage companies that strictly do home loans and don’t take deposits.

Brian Koss, executive vice president of Mortgage Network, which lends up and down the east coast, recommends asking about any Loan Estimate that seems too good to be true. The estimate might be incomplete. For example, maybe the loan officer forgot to include transfer taxes. If the Loan Estimate isn’t amended quickly, the lender might be able to back out of the unfavorable deal, or delay until the offer expires.

And, as always, apply with more than one lender and compare mortgage offers.

Want more? Check out the average closing costs for all 50 states.

Average closing costs by state (Map)