My prev job, about 10 years back I took because I liked the work a lot, and the pay was average or a bit low. After being there for 6 months, they started shedding engineers, and I got to take on double what I was first hired for. The company was making out real well on me. Now, generally I'm all for the free market program, and I agreed to work there, and they and I agreed on a salary given the conditions. About 4 months in, they got rid of one of my best associates, and hired a jack-banana whom I interviewed and rejected. I warned them that it was a mistake, but I didn't have veto power, just tech interview. I warned them it wouldn't work in the clearest terms without threatening.
They didn't listen, so I went on two interviews, and gave notice the following monday. The VP of ops called me and said my paycheck would be significantly higher next pay period. They gave me a 22% bump, and thought I would stay. When I didn't retract my notice, they got angry, and I went back to my emails where I warned them not to get rid of my good guy and replace him with a mouth-breather. They offered to give me another 15% if I would stay. Nope, a decision is a decision. My new job paid as much as their upper limit, and the work is even better.
Some places know how to retain people and some don't care. My short stint with EMC years ago was quite entertaining.