SB 10.81.6-7

sarva-bhūtātma-dṛk sākṣāt
 tasyāgamana-kāraṇam
vijṅāyācintayan nāyaṁ
 śrī-kāmo mābhajat purā
patnyāḥ pati-vratāyās tu
 sakhā priya-cikīrṣayā
prāpto mām asya dāsyāmi
 sampado ’martya-durlabhāḥ
Synonyms: 
sarva — of all; bhūta — living beings; ātma — of the hearts; dṛk — the witness; sākṣāt — direct; tasya — his (Sudāmā’s); āgamana — for the coming; kāraṇam — the reason; vijñāya — understanding fully; acintayat — He thought; na — not; ayam — he; śrī — of opulence; kāmaḥ — desirous; — Me; abhajat — worshiped; purā — in the past; patnyāḥ — of his wife; pati — to her husband; vratāyāḥ — chastely devoted; tu — however; sakhā — My friend; priya — the satisfaction; cikīrṣayā — with the desire of securing; prāptaḥ — now come; mām — to Me; asya — to him; dāsyāmi — I will give; sampadaḥ — riches; amartya — by the demigods; durlabhāḥ — unobtainable.
Translation: 
Being the direct witness in the hearts of all living beings, Lord Kṛṣṇa fully understood why Sudāmā had come to see Him. Thus He thought, “In the past My friend has never worshiped Me out of a desire for material opulence, but now he comes to Me to satisfy his chaste and devoted wife. I will give him riches that even the immortal demigods cannot obtain.”
Purport: 

Śrīla Viśvanātha Cakravartī comments that the Lord momentarily wondered, “How has it come about, despite My omniscience, that this devotee of Mine has fallen into such poverty?” Then, quickly understanding the situation, He spoke to Himself the words related in this verse.

But someone may point out that Sudāmā should not have been so poverty-stricken, since appropriate enjoyment comes as a by-product of service to God even for a devotee who has no ulterior motives. This is confirmed in Bhagavad-gītā (9.22):

ananyāś cintayanto māṁ
 ye janāḥ paryupāsate
teṣāṁ nityābhiyuktānāṁ
 yoga-kṣemaṁ vahāmy aham

“But those who always worship Me with exclusive devotion, meditating on My transcendental form — to them I carry what they lack, and I preserve what they have.”

In response to this point, a distinction must be made between two kinds of renounced devotees: one kind is inimical to sense gratification, and the other is indifferent to it. The Supreme Lord does not force sense gratification upon the devotee who is extremely averse to worldly enjoyments. This is seen among such great renouncers as Jaḍa Bharata. On the other hand, the Lord may give limitless wealth and power to a devotee who is neither repelled nor attracted by material things, such as Prahlāda Mahārāja. Up to this point in his life, Sudāmā Brāhmaṇa was totally averse to sense gratification, but now, out of compassion for his faithful wife — and also because he hankered to have Kṛṣṇa’s audience — he went to beg from the Lord.