Bribery is prohibited and is a Sin
Allah says;
وَلَا تَأْكُلُواْ أَمْوَالَكُم بَيْنَكُم بِالْبَاطِلِ وَتُدْلُواْ بِهَا إِلَى الْحُكَّامِ لِتَأْكُلُواْ فَرِيقًا مِّنْ أَمْوَالِ النَّاسِ بِالاِثْمِ وَأَنتُمْ تَعْلَمُونَ
And eat up not one another's property unjustly (in any illegal way, e.g., stealing, robbing, deceiving), nor give bribery to the rulers (judges before presenting your cases) that you may knowingly eat up a part of the property of others sinfully.
Ali bin Abu Talhah reported that Ibn Abbas said,
"This Ayah is about the indebted person when there is no evidence of the loan. So he denies taking the loan and the case goes to the authorities, even though he knows that it is not his money and that he is a sinner, consuming what is not allowed for him."
This opinion was also reported from Mujahid, Sa`id bin Jubayr, Ikrimah, Al-Hasan, Qatadah, As-Suddi, Muqatil bin Hayyan and Abdur-Rahman bin Zayd bin Aslam. They all stated,
"Do not dispute when you know that you are being unjust."
The Judge's Ruling does not allow the Prohibited or prohibit the Lawful
It is reported in the Two Sahihs that Umm Salamah narrated that Allah's Messenger said;
أَلَا إِنَّمَا أَنَا بَشَرٌ وَإِنَّمَا يَأْتِينِي الْخَصْمُ فَلَعَلَّ بَعْضَكُمْ أَنْ يَكُونَ أَلْحَنَ بِحُجَّتِهِ مِنْ بَعْضٍ فَأَقْضِيَ لَهُ فَمَنْ قَضَيْتُ لَهُ بِحَقِّ مُسْلِمٍ فَإِنَّمَا هِيَ قِطْعَةٌ مِنْ نَارٍ فَلْيَحْمِلْهَا أَوْ لِيَذَرْهَا
I am only human! You people present your cases to me, and as some of you may be more eloquent and persuasive in presenting his argument, I might issue a judgment in his benefit. So, if I give a Muslim's right to another, I am really giving him a piece of fire; so he should not take it.
The Ayah and the Hadith prove that the judgment of the authorities in any case does not change the reality of the truth. Hence, the ruling does not allow what is in fact prohibited or prohibit what is in fact allowed. It is only applicable in that case. So if the ruling agrees with the truth, then there is no harm in this case. Otherwise, the judge will acquire his reward, while the cheater will acquire the evil burden. This is why Allah said;
وَلَا تَأْكُلُواْ أَمْوَالَكُم بَيْنَكُم بِالْبَاطِلِ وَتُدْلُواْ بِهَا إِلَى الْحُكَّامِ لِتَأْكُلُواْ فَرِيقًا مِّنْ أَمْوَالِ النَّاسِ بِالاِثْمِ وَأَنتُمْ تَعْلَمُونَ
And eat up not one another's property unjustly, nor give bribery to the rulers (judges before presenting your cases) that you may knowingly eat up a part of the property of others sinfully.
meaning, `While you know the falsehood of what you claim.'
Qatadah said,
"O son of Adam! Know that the judge's ruling does not allow you what is prohibited or prohibit you from what is allowed. The judge only rules according to his best judgment and according to the testimony of the witnesses. The judge is only human and is bound to make mistakes.
Know that if the judge erroneously rules in some one's favor, then that person will still encounter the dispute when the disputing parties meet Allah on the Day of Resurrection. Then, the unjust person will be judged swiftly and precisely with that which will surpass whatever he acquired by the erroneous judgment he received in the life of this world.