The story is described in this chapter of the Srimad Bhagavatam:
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 gods cannot obtain.” Thinking like this, the Lord snatched from the brāhmaṇa’s garment the grains of flat rice tied up in an old piece of cloth and exclaimed, “What is this? My friend, have You brought this for Me? It gives Me extreme pleasure. Indeed, these few grains of flat rice will satisfy not only Me but also the entire universe.”
After saying this, the Supreme Lord ate one palmful and was about to eat a second when the devoted goddess Rukmiṇī took hold of His hand. [Queen Rukmiṇī said:] "This is more than enough, O Soul of the universe, to secure him an abundance of all kinds of wealth in this world and the next. After all, one’s prosperity depends simply on Your satisfaction."
So Rukmini stopped him because Krishna's satisfaction at just one palmful of rice was already enough to give Sudama "an abundance of all kinds of wealth in this world and the next".
By the way, the sentiment Krishna expresses when he says "these few grains of flat rice will satisfy not only Me but also the entire univers" occurs in the Mahabharata as well; when Draupadi has only a morsel of rice in her pot and she has to feed group of sages, Krishna eats that single morsel of rice and that is enough to satisfy him and thus the entire universe, leading the sages to feel full as well.
Krishna expresses this notion earlier on in the chapter as well:
I regard as great even the smallest gift offered by My devotees in pure love, but even great offerings presented by nondevotees do not please Me. If one offers Me with love and devotion a leaf, a flower, a fruit or water, I will accept it.