Possible sources of salary info include
Job sites where people review and report on salary at their employer, even if anonymous its super likely that figuring out exactly who you are could be less than rocket science.
Credit reporting agencies.
Bullshit surveys where people answer questions like how much money you make.
Really smart educated guesses based on analyses of known good data from your own and similar employers/employees.
Big employers. As long as the data isn't directly shared with their fellow companies and only in fact with me they stand to benefit from me knowing how much they and their competitor pay so I can recommend the lowest salary an employee is likely to accept so they can minimize cost.
In short your employer doesn't know how much you make but I do and recommend based on that info. Further I can even perpetuate racism and sexism! If minorities and women are currently paid less I can let you know to offer less and still get applicants. If I train a computer to make that determination it can even decide such without me explicitly telling it to and we can blame the algorithm instead of me!
Go technology and go capitalism. High five!
This is of course entirely hypothetical but sufficiently trivial that I find it hard to imagine people not doing it.