It is obvious that a judge cannot take a bribe (see Shemot 23:8). Nevertheless it is somewhat surprising to find that the Gemara forbids a judge to take money from both sides in a trial as payment for his judgment.
The Gemara tells of a judge named Karna who accepted payment from both parties and then offered his ruling. The Gemara explains that he was allowed to do this only because he did not take it as payment, but rather as sehar batalah – replacement for the income he would have made during that time. The Gemara explains further that even accepting sehar batalah is usually considered inappropriate; Karna was an exception because he had a job that everyone knew about. He was an expert wine tester, and when he sat in judgment he had a clear loss of income, which he accepted instead from the litigants who came to him to listen to their case.
Karna was a first generation amora, a contemporary of Shmuel. Together they welcomed Rav when he arrived in Babylon from Israel. In Massekhet Sanhedrin we learn that the term dayyanei golah – Diaspora judges – refers specifically to Karna, who also edited a collection of baraitot that is called nezikin d’bei Karna. As the Gemara notes, Karna was a professional wine taster who could ascertain which barrels should be used immediately and which would benefit from further aging.
With regard to the basic question of our Gemara, many of the commentaries deal with the issue of why it would be forbidden to take payment from both sides when judging a case. The Gemara seems to connect this with bribery, but if a bribe is forbidden because it will lead the judge to favor one side in the case, why would there be a problem taking payment from both sides?
On one level, this is seen as an issue of bribery. The Meiri writes that having accepted money from both parties, the judge can no longer offer a true judgment because he is inclined positively towards both of them. On another level the problem is not an issue of bribery, but one of teaching Torah. There is a general principle that Torah should not be shared for a fee. Since it was given by God without cost it should be made available by scholars for free, as well.