I think the passage was related directly to the subject of almsgiving. That is my belief.
When Jesus heard this he said to him, “There is still one thing left for you: sell all that you have and distribute it to the poor, and you will have a treasure in heaven. Then come, follow me.” (Luke 18:22)
This is Jesus the Rabbi here. Jesus is sitting down in the classis rabbinical teaching position and people are aksing him questions. It is a specific rabbinical teaching technique where the teacher would throw out a quick reference to a specific scripture in order to bring the meaning of the entire scripture to the minds of the listenters. Jesus is in the role of a teacher and his statement about selling all you have and recieving treasure in heaven was probably a reference to chapter 29 of the Book of Sirach.
Dispose of your treasure according to the commandments of the Most High,
and that will profit you more than the gold.
Store up almsgiving in your treasury,
and it will save you from every evil.
(Sirach 29:11-12)
No one can say that Jesus didn’t quote the deuterocanonical books.
Sirach 29 is worth reading. The NAB version is
here.
It was taught that giving alms, fasting, and prayer were effective ways to fight the “Lust of the eyes”, the “Lust of the flesh” and the “Pride of life”.
Do not love the world or the things in the world. If any one loves the world, love for the Father is not in him. For all that is in the world, the lust of the flesh and the lust of the eyes and the pride of life, is not of the Father but is of the world. (1 John 2:15-16)
**Fasting **is a way to fight the “Lust of the flesh” or sexual lust. It teaches us to control our bodies and rely on God to get us through bodily craving.
**Prayer **is a way to fight the “Pride of life.” Prayer puts us in direct contact with God who is the creator of the universe. We can’t help but know our humility, our nothingness, and can’t help but be “Poor in spirit” when we converse with the Creator of the Universe in prayer.
Almsgiving is a way to fight the “Lust of the eyes.” The Jews were taught that giving alms was a way to fight the desire for material things. Have you been eyeing up a new Lexus lately? Drop $500 on a homeless shelter and see if you still crave that Lexus.

Looking at that new titanium driver down at the PGA store? Buy two weeks worth of groceries for the woman with three kids down the street who’s husband just walked out and you will have more joy than any golf club could ever bring.
Jesus uses it as a teaching moment for his disciples and raises it to supernatural levels for those who will literally be asked to give up everything - priests and bishops, monks and nuns, brothers and sisters. And we must be willing to do no less. What if God took everything away from us tonight? What if God allowed Satan to torment us like he did Job? Would we do what Job did and complain that God was unfair or would we follow Jesus?
But the idea of almsgiving, fasting and prayer as a way to combat temptation to lust and pride should not be lost on us. By giving alms freely we teach ourselves that it isn’t the end of the world, that we are not going to die because we gave a hundred bucks to a needy person, and that it really does bring great joy.
Dave Ramsey says that there are three things you can do with money - save it, spend it, or give it away - and that the most fun you will ever have with money is giving it away.

I wish I were better at it.
-Tim-