Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:177

Indeed, those who purchase disbelief ˹in exchange˺ for faith - never will they harm Allah at all, and for them is a painful punishment.  

Those who purchase unbelief at the price of faith, that is, taking it in place of it, they will not hurt God at all, with their unbelief, and there awaits them a painful chastisement (alīm means mu’lim, ‘painful’).
القرآن:٣:١٧٧

إِنَّ الَّذِينَ اشْتَرَوُا الْكُفْرَ بِالْإِيمَانِ لَنْ يَضُرُّوا اللَّهَ شَيْئًا وَلَهُمْ عَذَابٌ أَلِيمٌ  

{إن الذين اشتروا الكفر بالإيمان} أي أخذوه بدله {لن يضروا الله} بكفرهم {شيئا ولهم عذاب أليم} مؤلم.