God told us that He chose them with His knowledge, see verses: 44: 32-33
وَ لَقَدِ اخۡتَرۡنٰہُمۡ عَلٰی عِلۡمٍ عَلَی الۡعٰلَمِیۡنَ ﴿ۚ۳۲﴾
وَ اٰتَیۡنٰہُمۡ مِّنَ الۡاٰیٰتِ مَا فِیۡہِ بَلٰٓـؤٌا مُّبِیۡنٌ ﴿۳۳﴾
And had knowingly given them preference to the people of the world [107]
and had given them such signs in which there was a clear reward [for them.]
They were not just punished or cursed, when they fulfilled their terms with God, they were praised and rewarded by God. See, 35: 32
ثُمَّ أَوْرَثْنَا الْكِتَابَ الَّذِينَ اصْطَفَيْنَا مِنْ عِبَادِنَا ۖ فَمِنْهُمْ ظَالِمٌ لِّنَفْسِهِ وَمِنْهُم مُّقْتَصِدٌ وَمِنْهُمْ سَابِقٌ بِالْخَيْرَاتِ بِإِذْنِ اللَّهِ ۚ ذَٰلِكَ هُوَ الْفَضْلُ الْكَبِيرُ
[Precisely this truth was with the People of the Book as well. But they did not give it due importance.] Then We made those people the heirs of Our Book who We have selected from Our servants [128] [for this honour]. So, some of them are unjust to their souls,[129] some who are on the middle path [130] and some who by God’s grace take lead in virtues. [131]This, in fact, is a great blessing. [132]
They established great empires in the time of David and Solomon and kept the message of Tawheed intact. However, when they went wrong they were punished and cursed.