Image: Couple shopping for house © IT Stock Free, A.G.E. FotoStock

You know you're supposed to avoid "junk" fees when you get a mortgage. But here's the problem: Junk fees can be harder to spot than you might think.

Plenty of fees charged by the travel and banking industries are junk. Those fees are almost pure profit and barely related to the cost of providing the underlying service.

When you're getting a mortgage, though, many of the fees are associated with legitimate costs. Also, state laws and lender practices can vary a lot, resulting in different types of charges, plus a range of fees.

Lenders also can play games with fees and the interest rates they charge. One might offer a rate slightly lower than the competition but jack up the fees. Another may advertise a "no cost" mortgage, with the fees folded into a higher rate.

The good news is that you have more leverage these days to negotiate away excessive charges. The feds have put some teeth into rules that require lenders to stick to the good-faith estimates they give you at the start of the lending process. That's led to fewer surprise fees stuck in at the last minute.

But you still have to put some effort into the process if you want a good deal.

"Most consumers don't shop, and that's really bad," said Andrew Pizor, a staff attorney of the National Consumer Law Center. "You're allowed to negotiate. You're allowed to haggle, and you should."

Liz Weston

Liz Weston

The best way to shop for a mortgage is to apply with at least three lenders and compare their good-faith estimates on similar loans, said Holden Lewis, an assistant managing editor for Bankrate.com, which surveyed closing costs in each state last year.

Shopping around can be expensive if the lenders charge application fees (not all do, but some charge up to $500). The potential savings, though, may make paying the charges worthwhile.

Here are some key fees to compare:

Origination fees

Lenders may chop these up into different categories and call them by various names: commitment fees, application fees, processing fees, underwriting fees. The handles don't matter as much as the total, which is what will be shown in the "A" box on Page 2 of the three-page good-faith estimate.

You're likely to pay more in some states than others, the Bankrate survey found. Origination fees for a $200,000 home loan averaged $2,210 in New York state but $1,406 in neighboring New Jersey.

Even within a state, origination fees can run the gamut. In New York state, the fees ranged from the low $700s to more than $4,000.

These costs are supposed to reflect the work that goes into creating your loan -- and there's certainly more work involved these days, as underwriting standards and licensing requirements have gotten tighter, Lewis said.

Still, there's clearly plenty of room for padding here, which is why you want to compare at least three lenders' bids for your business and check the averages for your state.

Note that origination fees can also include "points," or a percentage of the loan you pay to lower the interest rate. Paying points can make sense if you're going to be in the home, and keep the loan, for many years. But if you're comparing the origination costs of one loan that includes points to another with a higher rate that doesn't include points, you're not really comparing apples to apples. It would be better to compare two deals that include points, or to subtract the cost of the points from one deal to better compare the remaining costs.

And remember: These costs are negotiable. A lender who tells you otherwise is probably hoping to take advantage of ignorant borrowers.

Appraisal fees

Lenders hire appraisers to evaluate your property's value -- and high-end properties may require two independent appraisals, said Ilyce Glink, the author of "Buy, Close, Move In" and "100 Questions Every First-Time Buyer Should Ask." Appraisal fees typically range from $225 to $750, depending on the value of the property. In the Bankrate survey, appraisal fees were generally under $400.

Again, if the lender is proposing to charge more, you should find out why.

Lenders aren't supposed to mark up third-party services, which include appraisals, credit reports, settlement fees, flood certifications, pest inspections, surveys and title work. But lenders also don't have to choose the most economical providers. Cozy business relationships may make lenders more interested in keeping a treasured partner happy than in giving a good deal to their borrowers.

Kathy Kristof's lender wanted to charge her $700 for an appraisal two years ago, when she was refinancing her home. Kristof, a Los Angeles personal-finance columnist and the author of "Investing 101," asked why the charge was so high and was told the bank was paying "for an exceptionally thorough job," since the market in her area was declining.

Click here to become a fan of MSN Money on Facebook

Because she had a lot of equity, Kristof knew she could argue the point. She pointed out that her loan represented only a small fraction of the home's value, so the risk to the lender was minimal. The lender then used an electronic appraisal that cost her just $75.