I remember in my previous job, I had a senior sysadmin who had been with the company for 10 years and earning $70k ... we were hiring new sysadmins off the street for $100k. He complained about it and I tried everything I could to get him a payrise because he was a good performer - but company policy was that pay rises could not be more than 10% without exec approval. So the best I could offer him was $77k - in my justification for more, I compared market rates, how much it would cost the company if we had to replace him ($100k in salary alone let alone recruitment costs) etc - but the reply back from HR was 'we bet he won't leave'. And sure enough he didn't. It really saddened me - the fact is he could get a job elsewhere that paid way more, but he was too 'comfortable' in his position.
In my experience, people tell themselves all sort of stories why they don't leave - I'm still learning lots, I like the people I work with, I need a little more experience etc - all of this may be true to a degree, but going by the number that complain about being overworked/underpaid, a lot of them simply are excuses.
Companies know and understand this - and hence people often may get underpaid.