The answer is simple: the law is a schoolmaster to lead people to Christ. That's exactly what happened in the story. The law led the rich young ruler to Christ...literally. But he rejected Christ in favor of riches.
The law couldn't save him. Christ could have.
I don't need a commentary to understand scripture. I have the Holy Spirit. Try reading John 5:39-40. This is what happened to the rich young rulers, the Pharisees, and all who rely on their keeping of the law.
yep it led them here so they could hear the word promising life
“For the Father judgeth no man, but hath
committed all judgment unto the Son: Verily, verily, I say unto you, He that heareth my word, and believeth on him that sent me, hath everlasting life, and shall not come into condemnation; but is passed from death unto life.”
John 5:22, 24 KJV
“It is written in the prophets, And
they shall be all taught of God. Every man therefore that hath heard, and hath learned of the Father,
cometh unto me.”
John 6:45 KJV
“For
he whom God hath sent speaketh the words of God: for God giveth not the Spirit by measure unto him.
The Father loveth the Son, and hath given all things into his hand. He that believeth on the Son hath everlasting life: and
he that believeth not the Son shall not see life; but the wrath of God abideth on him.”
John 3:34-36
Mankind had already been condemned to death by sin when the law was given made thier lifespan 120 years in genesis 6 way before the law . The law says if they obey it perfectly they’ll be blessed and then die like Moses it’s mediator at 120 (Deuteronomy 34:7)
eternal life wasn’t offered in the Bible until the messiah came it was always promised for when he came preaching salvation from death and offering life everlasting ( the good news to mortals condemned to death is God has offered us life everlasting in the gospel )
“
Jesus said unto her, I am the resurrection, and the life: he that believeth in me, though he were dead, yet shall he live: and
whosoever liveth and
believeth in me shall never die. Believest thou this?”
John 11:25-26 KJV