Mishpatim: Rabbeinu Bachya: Mitzvah 77 – Concept 568
“And you shall not curse a leader among your people.” (Exodus 22:27) We may not curse the head of state or leader of the Sanhedrin. (Rambam, Hilchot Sanhedrin – The Laws of the Sanhedrin)
A Midrashic approach, based on Shemot Rabbah 31:8, there is a conceptual linkage between verse 27, not to curse people in authority, and the following verse, which deals with the setting aside and handing over the various tithes, etc. If people will fall into the habit of cursing their judges and their king, the result will crop failure, they will not have any tithes to set aside.
The Midrash cies as a case in point the beginning of the Book of Ruth, which commences with the words, “and it was in the days when they judged the judges, which is understood to mean that the period during which this story occurred one when common people judged the judges, and were openly disdainful of them. In the verse following we are told of a major famine in Israel, which led to the emigration of Elimelech and his family. This is an illustration of how one sin results in other sins. Rabbeinu Bachya