My first question to any recruiter is now always "what's the salary range for this role?" precisely because I've run into your first point earlier in my career. I'm not even particularly salary-driven (doing interesting, valuable work is far more important!) but it's the best indicator that the role is pitched at the right level for me.
From an employer's point of view, there's also the avoidance of future unpleasantness if (or, rather, when) it comes to light that some staff are paid significantly less than their peers.
Responsible employers don't need mandatory salary disclosures to do the right thing here but, sadly, not all employers are responsible so this sets a common baseline and ensures everyone plays by the same rules.