Which of these would you prefer:
- Ensuring you retain the same employee for the long-term, even if that means overpaying for them.
- Ensuring you pay the lowest wage your employee will agree to, even if that means having to rehire for the position more frequently.
As an employee, you obviously prefer the first option, since that entails a nicer wage for you and you want to receive more. But as an employer, that incentive is reversed, as you want to pay less.
If the money spent on rehiring (i.e. the wage of your HR officer for the time required to hire a new employee + the wage for your dev team for the time required to bring a new hire up to speed) is lower than the amount of money you save on the lower developer wage, and there is an endless supply of adequate applications for the position, then the latter option is more profitable, financially speaking.
Companies are profit-driven (and even charities minimize internal costs to maximize charitable output) and therefore will always take the path of most profit.
If, however, the hiring process is very long and high-effort (and thus high-cost), and/or there's a high likelihood that you won't easily find a new employee, then you're going to want to retain your employees for as long as you can. This is why certain professions have generally higher wage scale, e.g. medicine, highly specialized trade skills, ...
This hits on the core principle of supply and demand. As the supply increases, the price lowers.