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.

Credit report fees

Lenders have to pay for pulling your credit reports and scores. Your interest rate and terms will be based in part on what they find. But lenders typically pay less than what you would to buy your own reports and scores, since they get volume discounts.

Credit report fees "should be in the low two digits," Lewis said. When the lenders Bankrate surveyed charged separately for credit reports, the fees were typically under $25. If you're being charged much more, you should ask why. A higher fee may be justified if more than one borrower is on the loan (requiring that more credit reports be pulled), but a comparison with at least two other lenders' good-faith estimates will help you know if the fees are in line with what others are charging.

By the way, your credit scores won't be penalized for applying at different mortgage lenders, as long as you do so in a relatively short period. The credit scoring formula most mortgage lenders use, the FICO, lumps all mortgage-related inquiries together and counts them as one hit, as long as the inquiries are made within 45 days. Furthermore, the scoring formula ignores all inquiries made within the previous 30 days. Your best bet: Apply at different lenders on the same day, and make your decision shortly afterward, to minimize the impact on your scores.

Title insurance and related services

A title insurer researches your property to make sure there aren't any problems involving the deed. Then it provides an insurance policy that covers the cost of defending against any challenges to the title.

There are two kinds of title insurance: lender's policies, which protect the lender and are usually part of the mortgage deal, and owner's policies, which protect you and may not be required. Glink suggests you get both, but who pays for what can vary.

In some areas of the country, for example, it's customary for the seller to pay for most or all of the cost of the buyer's title insurance policy. In other areas, it's customary for the buyer to pay. If you're picking up the cost for both policies, the toll can be thousands of dollars.

Bankrate's survey showed that title costs averaged $993 in North Carolina but $2,811 in New York state.

You may be able to shop around for cheaper title insurance. In some states, tight regulation keeps the costs about the same, but it's still worth checking online title insurance quote sites.

Kristof did that on her refinance and wound up saving $787 by using a company named Entitle Direct rather than the title company her lender had proposed. When she recently purchased a new home, she saved an additional $1,267.

"It's extremely important to shop, no matter whether you're refinancing or selling a home," Kristof said. On her recent purchase, "the original quote was $3,645. The quote I got after 10 minutes of shopping: $2,378."

Even if shopping around doesn't land you big discounts, you may be able to get a break on the costs if you buy both lender's and owner's policies from the same company. Also, if you're refinancing rather than buying and have lived in the house for less than 10 years, ask for the "reissue rate," which should be lower.

Courier, postage and wire-transfer fees

That these fees even exist in an era of scanners, email and electronic funds transfers is kind of amazing, yet many lenders persist in charging them.

These fees do serve one important purpose. They can give you a quick idea of whether you're getting gouged.

A lender should be open to reducing or waiving these fees if they're being charged as part of the origination costs. If they're third-party fees, they should at least be reasonable and in line with what other lenders charge. Postage and courier costs typically average $55 to $75, the Bankrate survey found. If you're being charged $100 or more, that's a sign to start making a fuss.

Finally, to make sure there are no last-minute surprises, ask your lender to give you a form called a HUD-1 at least 24 hours before your loan is scheduled to close. This form lists all the fees you'll be charged and should closely match the good-faith estimate you were given at the start.

If not, start asking why. If you don't get good answers and the lender won't modify the fees, your greatest power lies in your readiness to say no.

"You have to be willing to walk away from a bad deal," Pizor said.

Liz Weston is the Web's most-read personal-finance writer. She is the author of several books, most recently "The 10 Commandments of Money: Survive and Thrive in the New Economy" (find it on Bing). Weston's award-winning columns appear every Monday and Thursday, exclusively on MSN Money. Join the conversation and send in your financial questions on Liz Weston's Facebook fan page.