Payroll can be part of both HR and finance, and at times it can be an entirely separate function, depending on the size of the company. Since payroll takes into account things like sick leave, overtime rate, and bonuses, it often requires input from both HR and finance advisors.
Naturally, anybody working in payroll would require expertise in financial administration. For many smaller companies, the finance department is mainly the one to look after it. In bigger corporations, it becomes more important to track HR costs in relation to turnover, so both departments overlap and become more involved.
Aside from dealing with employee payments, payroll is also involved in filing companies local, state and federal taxes. These may also involve the legal department.