On the converse, your boss doesn't pay the cost of hiring new people. It doesn't come out of his pocket. But giving 20% raises to everyone he has the suspicion of leaving will get him canned real quick, imposing a real and sizeable cost on him.
The tippy top dogs of the company aren't completely stupid for running things this way. Budgets would get out of control in a hurry if they let managers do whatever they want with wages. Nepotism would run rampant without costly oversight and surveillance. Employees would learn to take advantage of easy raises.
So the company bears a smaller cost (employee turnover) rather than the bigger and unpredictable costs of frequent and decentralized wage raises.
There's not a great solution to this. It's an example of market failure. Everyone acting in rationally on an individual scale does not lead to group rationality.