I ask the recruiter up front what the salary range is for the job to avoid the scenario you outline. I'm surprised how often they give me an answer. It's saved us both a lot of time.
That's kind of my point, although recruiters tend to get slippery here with language like "it's <x-y> but if you're good we are flexible"...then you find out they're not.