All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
It is true that the supplications of a disbeliever may be answered if he is sincere and genuinely turns to his Lord. Allah, the Exalted, says (what means): {And when waves come over them like canopies, they supplicate Allah, sincere to Him in religion. But when He delivers them to the land, there are (some) of them who are moderate (in faith). And none rejects Our signs except everyone treacherous and ungrateful.} [Quran 31:32]
It is also true that sins in general, including unlawful earnings, may prevent the Muslim's supplication from being answered. Sin may be a reason for every tribulation and calamity. Allah, the Exalted, says (what means): {And whatever strikes you of disaster - it is for what your hands have earned, but He pardons much.} [Quran 42:30]
"The Prophet, sallallahu ‘alayhi wa sallam, mentioned the man who undertakes a long journey, with his hair disheveled and him covered with dust. He raises his hands to the sky and says, 'O Lord! O Lord!' while his food is from unlawful earnings, his drink is from unlawful earnings, his clothing is from unlawful earnings, and he was nourished by unlawful earnings. How then can his supplication be answered?" [Muslim]
There is no contradiction in what you mentioned. The disbelief of the disbeliever is a much greater sin than his consumption of unlawful earnings; however, Allah answers his supplication for a certain wisdom. Allah, the Exalted, says (what means): {Is He (not best) Who responds to the desperate one when he calls upon Him and removes evil and makes you inheritors of the earth? Is there a deity with Allah? Little do you remember.} [Quran 27:62]
Al-Qurtubi said in his interpretation of this verse, "Allah, the Exalted, has guaranteed to answer the distressed when he invokes Him and has informed us of this about Himself. The reason for this is that the turning of the distressed person to Allah originates from sincerity and an aspiration in the heart to Him alone. Sincerity holds a great value to Allah, regardless of whether it came from a believer or a disbeliever, an obedient or an impious person."
It should be noted that although the sins of the Muslim sinner or the one who consumes unlawful earnings prevent his supplications from being answered, this is not necessarily the case all the time. Allah, the Exalted, may answer his supplication if He wills for a given wisdom.
Allah knows best.