«وَمَغْنَاهُ غُنْيَةً»
I regarded his dwelling or company as a source of sufficiency.
Maghnā may indicate a residence or place of stay, while ghunyah means sufficiency or freedom from need. Their near-rhyming forms present friendship as a kind of wealth.
That is emotional and intellectual sufficiency, not proof of material prosperity. The later narrative will contrast the richness of companionship with real financial hardship.