Is there a halakha that a rabbi must have a salary in a community?
There is no halacha that the Rabbi must be paid. In certain ways it is the correct thing to do. After all, everyone does get services from him and it is not an easy job, and he should be paid. Additionally, being that it is a hard job, it always helps if he is paid, so that he will want to continue doing it. On the other hand, there are times when the Rov will specifically not want to get paid, so that the people in the community will not feel that they are his boss and can tell him what to do. The Rov is the authority in the shul as it is up to him to make the religious and halachic decisions, not the baalei batim, and in certain ways if he doesn’t get paid it gives him a certain authoritative respect.