Story related to Dhammapada Verse 19-20: TheTwo Friends
While residing at the Jetavana monastery, the Buddha uttered Verses 19 and 20, with reference to two bhikkhus who were friends.
Once there were two monks who were friends from Savatthi. One of them learned the Tipitaka (teachings of Buddha) and was very proficient in reciting and preaching the sacred texts but did not practice meditation. He taught 500 monks and became the instructor of 18 groups of bhikkhus. The other monk striving diligently and ardently in the course of Insight Meditation attained arahantship (enlightenment) together with Analytical Insight.
On one occasion, both of them came to the Jetavana monastery, the two bhikkhus met. The master of the Tipitaka did not realize that the other had already become an arahat (enlightened one). He looked down on the other, thinking that this old monk knew very little of the sacred texts, so he wanted to embarass him by asking him questions in front of Buddha. Buddha knew about his unkind intention and he knew that as a result of giving trouble to such a noble disciple, the learned bhikkhu would be reborn in a lower world.
So, out of compassion, the Buddha visited the two bhikkhus to prevent the scholar from questioning the other bhikkhu. Buddha himself did the questioning. Buddha asked some practical questions about the Dhamma. The Arahant answered them all from his personal experience, but the learned monk could not, as he had not attained anything. Buddha praised the Arahant who had practised and understood the Dhamma well.
The resident disciples could not understand why the Buddha had words of praise for the old bhikkhu and not for their learned teacher. So Buddha explained that although the learned monk knows a great deal but he does not practice in accordance with the Dhamma. So he is like a cowherd, who looks after the cows for wages, while the one who practises in accordance with the Dhamrna is like the owner who enjoys the five kinds of produce of the cows. Hence the learned monk could not enjoy the benefits of Magga-phala (fruits of enlightenment). Whereas the other bhikkhu who has attained enlightenment, truly shares the benefits of Magga-phala.
In other words, even if someone studies the teachings by heart but do not practice what they have learnt, they will not attain and will not enjoy the fruits of enlightenment. Whereas for another who may not know all of the teachings but practices in accordingly and having understood the meaning behind the teachings, will attain and enjoy the fruits of enlightenment. We must learn and practice at the same time.