"Do not accept a bribe, for the bribe will blind those who see and corrupt words that are just." (Shemos 23:6.) The Torah prohibits a judge from taking a bribe because that will influence him and prevent him from judging impartially.
The Gemara (Kesubos 105b) points out that accepting a bribe refers not only to shochad mamon - a monetary payment. Even shochad devarim - a bribe of words - is forbidden. This includes accepting a favor or any kind of non-monetary benefit from one of the litigants.
The Gemara gives several examples of how careful the chachomim were about this halacha. Shmuel disqualified himself from judging a case which involved someone who had helped him cross a bridge. Ameimar refused to judge a case because one of the litigants had removed a feather that had fallen on Ameimar's head. Mar Ukva recused himself from a case which involved someone who had cleaned the street for him. And Reb Yishmael b'Reb Yosi refused to judge his sharecropper after the sharecropper brought Reb Yishmael's portion of fruits one day earlier than usual.
At first glance, the Gemara seems puzzling. Did these chachomim really believe that their judgement would be clouded just because one of the litigants did a small favor for them? Would they really have a prejudice just because someone helped them cross the street or cleaned their hat? Why were they so quick to disqualify themselves? After all, Rashi writes (Kesubos 106a) that it is a mitzvah to judge a case if one is able to do so.
One answer might be that these chachomim understood how powerful even a small negiyah, a small interest, can be. If someone does a favor for a judge, it is impossible for that judge not to feel some kind of affinity toward the person who did him the favor. Even if a negiyah is so small that it seems insignificant, the fact is it will give the judge a bias and prevent him from judging impartially. The Gemara (ibid) cites this idea in the name of Rava. "Why is it forbidden to take a bribe? The reason is that when a person accepts a bribe ikriva lei daytei legabei vehavi k'gufei - he feels close to the donor, as if the donor is like himself, and a person does not see wrong in himself. What does the word shochad mean? Shehu chad - it is something that makes them like one."
This is one way to understand the behavior of the chachomim in the Gemara. But Rav Pam explained differently. He suggested that the Gemara is not simply highlighting the powerful effect that even a small bribe can have on a judge. Rather, the Gemara is teaching the importance of hakaras hatov, of appreciating every small favor that another person does for us. The chachomim mentioned in the Gemara appreciated every small kindness they benefited from, and that is why they were concerned that if someone did them a favor, they would not be able to judge them without bias, because even a small favor would be considered in their eyes like a significant bribe since they appreciated it so much. The message of the Gemara is that we should appreciate every small favor someone does for us. We should feel that they are giving us so much even if in reality they are doing very little for us.
Often people feel a sense of entitlement. They don't appreciate what others do for them, especially when the other person is someone they interact with on a daily basis like a parent or a spouse. People don't feel the need to thank someone else for their time and effort, for their financial or emotional support. The prohibition of accepting even a small bribe demonstrates the sense of gratitude that we should feel for every small kindness that someone else does for us.
But perhaps the greatest hakaras hatov that we should feel is toward Hakadosh Boruch Hu. The story is told about a young man who saw the Chofetz Chaim davening a long Shemoneh Esrei. He said to him, "Rebbe, I see you're davening a long Shemoneh Esrei. What great kavanos (intentions) do you have? I'd like to have some of those kavanos too." The Chofetz Chaim sighed and said to the young man, "I don't really have such lofty kavanos. I just try to have in mind the simple meaning of the brachos of the Shemoneh Esrei. But when I get to the bracha of Modim, and I think of everything Hakadosh Boruch Hu has done for me, it just takes a long time to say thank you." If only we appreciated the importance of expressing our hakaras hatov for every small kindness, we would realize there is a lot to say thank you for.