Ambitious employees "know" that switching jobs will give them the pay they're looking for, because they see those numbers right on the job postings. What's less obvious is that a current employer might really value an employee's skills, and would be willing to match or exceed the competition - if they just open up the conversation.
IME it's not even (always) any kind of rational decision on behalf of management to "stiff" people. If you have a happy employee making a wage they're satisfied with (+ annual COL), then these conversations about TC may not even come up at all. It's easy to just turn on autopilot here.
If you like your job, but you're not happy with your TC, make sure you're letting management know. It could be that everybody could end up happy. Even a good manager might not be doing this for you until/unless you advocate on your own behalf.