مَنْهُومٌ فِي الْعِلْمِ لَا يَشْبَعُ مِنْهُ
A person eager for knowledge is never satisfied with it.
وَمَنْهُومٌ فِي الدُّنْيَا لَا يَشْبَعُ مِنْهَا
A person eager for worldly things is never satisfied with them.
In the first expression, ـهُ in مِنْهُ refers to الْعِلْمِ. In the second, ـهَا in مِنْهَا refers to الدُّنْيَا. فِي means “in / in regard to,” and مِنْ means “from”; distinguish it from مَنْ, “who.”
Recognizing these two pronouns makes the parallel meaning of the narration clear.