I don't think it's ethical unless the money received by the teacher is put to good use such as donating it for a cause, and if the students have expressed their agreement to such regulation/policy. Otherwise, it can be seen as an abuse of power for personal gain.