You could say the giving of the law was one of those “instances where man is encouraged to make the right choice”, as well as telling man what is right and what is wrong. Was the idea that man could by his imagined free will keep the law & save himself, if he so chose? No, the law was a ministration of death, of the letter that kills (2 Cor.3:6-7).
The purpose of the law, according to the following opinion:
"Question: “What is the purpose of the Mosaic Law?”
Answer: The Mosaic Law was given specifically to the nation of Israel (Exodus 19; Leviticus 26:46; Romans 9:4). It was made up of three parts: the Ten Commandments, the ordinances, and the worship system, which included the priesthood, the tabernacle, the offerings, and the festivals (Exodus 20—40; Leviticus 1—7; 23). The purpose of the Mosaic Law was to accomplish the following:
(1) Reveal the holy character of the eternal God to the nation of Israel (Leviticus 19:2; 20:7–8).
(2) Set apart the nation of Israel as distinct from all the other nations (Exodus 19:5).
(3) Reveal the sinfulness of man (cf. Galatians 3:19). Although the Law was good and holy (Romans 7:12), it did not provide salvation for the nation of Israel. “No one will be declared righteous in God’s sight by the works of the law; rather, through the law we become conscious of our sin” (Romans 3:20; cf. Acts 13:38–39).
(4) Provide forgiveness through the sacrifice/offerings (Leviticus 1—7) for the people who had faith in the Lord in the nation of Israel.
(5) Provide a way of worship for the community of faith through the yearly feasts (Leviticus 23).
(6) Provide God’s direction for the physical and spiritual health of the nation (Exodus 21—23; Deuteronomy 6:4–19; Psalm 119:97–104).
(7) Cause people, after Christ came, to see that they couldn’t keep the Law but needed to accept Christ as personal Savior, for He had fulfilled the Law in His life and paid the penalty for our breaking it in His death, burial, and bodily resurrection (Galatians 3:24; Romans 10:4). The believer in Christ has the very righteousness of the Law fulfilled in him as he obeys the Holy Spirit who lives within him (Romans 8:4)."
gotquestions.org/Mosaic-Law.html