How significantly does the salary amount for tenured faculty impact the quality of a deparment? I mean both the salary a department offers to new hires and to already hired faculty members. I would prefer answers specifically about math departments, but I would also be interested in answers about departments in other STEM fields as well as other fields such as the humanities or the social sciences.

My motivation for this question came from another question I asked recently on another website. I had asked specifically how math departments improve and received the answer that with enough money, a math department could hire and keep the best researchers in some specific field. Now I'm asking here to confirm that that is indeed the case for math departments, but I am now also interested in seeing if this applies to all departments in academia in general.

EDIT:
I cannot give a specific criteria for "quality" as I assume this may vary from field to field. What I can say somewhat concretely, though, is that research productivity should be weighted above attention to teaching. Of course, if a department happens to have one or two extremely productive researchers in some specific field but does not offer a PhD program, then I would not considered that department a top department.
There are several main financial factors faculty candidates must consider when weighing offers:


Salary and resultant standard of living
Overall compensation package (health, retirement and pension, other benefits)
Institutional support (resources, personnel, infrastructure)


The first two are with respect to the financial resources committed directly to the faculty member; the last is the amount of resources committed to the professor's working group. It is difficult to say how much the different factors are weighted, as this is highly subjective and personal.

However, I would caution against considering absolute salaries as a metric; salaries always have to be considered relative to the cost of living in one's environment. (Would you rather have $50,000 in New York City or $40,000 in Akron?)