I've come to the realization that the reason employers don't tell you upfront what the salary is has everything to do with the sunk cost fallacy. The sunk cost fallacy is the idea that “well, I've already put in X amount of time doing something, what's 1/10th X more” or “I've paid $5k already, what's another 2?” even when the reward isn't worth it.
In the job search, employers know that, told the pay upfront, a large portion of candidates would simply walk away early on or not apply in the first place. In stringing you along, making you jump through hoops, meet different people, become hopeful about finding a new job, etc., they're hoping you'll think, “God, do I really want to start this whole process over somewhere else, when I might only make marginally better money?”
I think a lot of people recognize it's a tactic to increase the number of candidates you get and to keep wages down, but this aspect of it is less talked about I feel.