This is the distinction between third-party recruiters and first-party recruiters. When I was hired via a third-party recruiting company, all negotiations happened via the recruiting company on behalf of myself. This was successfully because, as you mentioned, our interests were aligned, and as a result, I went from a 60k a year role to a 120k a year role. On the other hand, when I moved on from the 120k a year role, I dealt with first-party recruiters, where their interests were aligned with the hiring company, which means attempt to bring me on as cheap as possible. In the later case, it is clearly not in your best interest to disclose salary.