I know this logic is common, but I'm not at all sure it's true. Hiring at the minimum you can is a major source of turnover, at least in high-turnover industries like software. If someone is work 50k-70k and you offer them 50k, there's a real risk that they'll get a recruiter calling in 8 months talking about 70k. Hiring is expensive, both directly (several months salary in costs?) and indirectly (repeated ramp-up periods and a loss of institutional knowledge), which makes this into a serious false economy.
I've seen several companies get themselves into real trouble by striking too many 'good' salary deals. They ended up serving as springboards for people who didn't yet know their own value, and losing all their hires within a year or two. Well, almost all - the ones who stuck around were often the less-capable hires they'd overvalued in the first place!
For example over a few years and 3 jobs, I found that $120k was about the max for senior devs in my city and tech stack. When interviewing I would lead with "is 120k in the range for this position?". And getting that could sometimes be a stretch. When I found a company offering 10-15% above that, I took it. I knew they were desperate, and the work would probably suck (and I was right) but no overtime and lot's of vacation make up for it (for now).
It does not have to be a detailed initial conversation, something as simple as "what is the salary range for this position, due to my current responsibilities and level I am looking for something in the range of x to y. Is that realistic?" HR will give you a yes or no, you say thank you and decide where to go from there.
This cuts both ways too. If a candidate asks the salary before the interview, many companies will perceive the candidate as not caring about the work, and being "only in it for the money".
And if a candidate doesn't wait until the interview to discuss money, they have very little to justify the average market-rate wage they're trying to convince the company to pay them.
The owners, the shareholders, are "only in it for the money". It makes sense therefore that all other participants interacting with the company are also. Promulgating a behavior standard under the guise of propriety that doesn't align with the owners' position is shipping out an externality to everyone at the table who follows that standard, benefiting only the shareholders.
I'm not a fan of this approach to business myself, but that's the cards we've all been dealt, and until the system is changed, we learn how to play by the right rule book.
My reason for not leading with salary is basically that I'm going to be asking them for the high end of what I hope I've accurately ascertained to be their range, and I'd rather the first impression I leave them with be "we have to get that guy" rather than "is he really worth what he's asking"?
Yes, it costs some time I suppose, but I find there are very few activities one can engage in that are more lucrative per hour than correctly doing a job hunt. I can eat the time if need be.
The only reason to show that I care about the work and take potentially less salary is if I think the economy is going to take a turn for the worse and I need a job for 3-10 years to ride out the storm. In which case I have to take a lower salary, but at least I have a job. Remember, I can't know how much the company is able/willing to afford.
And just to clarify, not caring about the work doesn't mean doing a terrible job. It means giving them what I'm paid for, but I'm not going to go the extra mile for them (overtime) because there's no incentive to do so.
This is just my opinion though and is in no way a road map for others.
I once asked an internal recruiter the salary (as to not waste each other's time) and he returned a tirade of abuse about me not clearly being a good fit if money is my only focus. The guy organises a few meetups as well, fair to say I'll avoid anything he touches at all costs.
Edit: if you publish/ let me know the the range, I'm happy to interview.
The company will hire you for as little as they can. Which is logical for the company. Often there is a range but the employee will not know it unless they insist on asking for what they perceive they are worth.
Lately I have seen a trend where people wont even ask the salary until they have interviewed because they don't want to appear rude. I just don't get it. You should provide your salary expectations prior to reaching the interview stage otherwise you are potentially wasting your time.