Great advice. It took me years to learn it on my own. One thing I would like to add is there are times you have to clam up completely and refuse to give out even a range. At one of the companies I worked for, they had a weird policy of not hiring people if their new salary would exceed their old salary by more than 20%. Now, I can understand some of the reasoning behind it, but I personally find it detestable. The best policy in such a case is to either pass (which in this case would have been a shame, because the job was good in all other respects) or clam up and have them decide whether to hire you based on your merits alone.
If a company is operating with such byzantine and clearly poorly-implemented hiring practices, there are probably plenty of better opportunities out there.
I got screwed by a policy like that years ago when I moved from the DoD back into the private sector. I was honest (and naive) when filling out the HR paperwork and listed my low gov't salary. Come to find out later they knocked 15K off the salary.
Such rules are usually driven by HR, not by hiring managers. The hiring manager's motivation is to get something done. Your compensation is a rounding error on the revenues from a successful product or whatever it is you are hired to create.
HR, on the other hand, exists to create a "system." One of the primary properties of the system they are trying to create is predictability. If you have a process of some sort, anybody ought to be able to put the same inputs in and get the same outputs out.
Thus, they look for a good way to explain what you are offered. Capping it based on your previous compensation is a nice, simple rule that fits well with a process. Paying you some random amount based on how urgent your skills are needed on a team is not a repeatable process.
In a weird way, although HR talk a good line about people and soft skills and values and missions, they behave just like autistic programmers: They put numbers and rules ahead of people and priorities.
HR departments are a subclass of the same abstract base class as procurements departments. In both cases, the real job of the department is to reduce specifically-enumerated-company-cost X by Y%. All other responsibilities are window-dressing.
Any simple intervention that can be accomplished by HR that comes with a simple story about reducing salary costs is likely to become company policy.
I never inquired about it, because I was afraid that I might respond with something I would later regret. However, I speculate that in their case it was because they must have spent way too much money initially, when they first opened up their offices in my country. I don't know whether the salaries they offered initially were a part of aggressive hiring plan or just a result of someone's incompetence in HR; given the usual level of competence in their HR, it would be really hard to tell which of those two it was. However, the job was really good in all other respects.