فَوَيْلٌ لِّلَّذِينَ يَكْتُبُونَ ٱلْكِتَـٰبَ بِأَيْدِيهِمْ ثُمَّ يَقُولُونَ هَـٰذَا مِنْ عِندِ ٱللَّهِ لِيَشْتَرُوا۟ بِهِۦ ثَمَنًا قَلِيلًا ۖ فَوَيْلٌ لَّهُم مِّمَّا كَتَبَتْ أَيْدِيهِمْ وَوَيْلٌ لَّهُم مِّمَّا يَكْسِبُونَ Qur’an Al-Baqara (2:79)Fawaylun lilla th eena yaktuboona alkit a ba biaydeehim thumma yaqooloona h atha min AAindi All a hi liyashtaroo bihi thamanan qaleelan fawaylun lahum mimm a katabat aydeehim wawaylun lahum mimm a yaksiboon a
The reference here is to the scholars responsible for corrupting the text of the Bible and thus misleading their ignorant followers. The "trifling gain" is their feeling of pre-eminence as the alleged "chosen people".
i.e., warning of a curse or punishment.