I have no insight into other universities, but at Stockholm University, it's not the department that decides who is hired as professor.
The faculty has an appointment board where a department representative is present during the interview, but they have to leave when the actual decision is discussed and made. Since we are not experts in the department's field, we use external reviewers, but we also use our own judgement in deciding who the best candidate is.