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.