The psalmist sings, “The righteous shall flourish like the palm tree: he shall grow like a cedar in Lebanon. Those that be planted in the house of the Lord shall flourish in the courts of our God. They shall still bring forth fruit in old age; they shall be fat and flourishing; To shew that the Lord is upright: he is my rock, and there is no unrighteousness in him.” He says that the Lord is upright, and in him is no unrighteousness. As evidence for this he cites the righteous who flourish, grow, and bring forth fruit in old age. In Genesis 18 Abraham pleads for God to spare his nephew Lot from destruction with Sodom and Gomorrah. To do so, he says to God, “That be far from thee to do after this manner, to slay the righteous with the wicked: and that the righteous should be as the wicked, that be far from thee: Shall not the Judge of all the earth do right?” (Gen 18:25). In Deuteronomy 32, Moses sings a song in the hearing of Israel. In verse 4 he sings, “He is the Rock, his work is perfect: for all his ways are judgment: a God of truth and without iniquity, just and right is he.”
Now, in Exodus 20:5-6 God says, “…I the Lord thy God am a jealous God, visiting the iniquity of the fathers upon the children unto the third and fourth generation of them that hate me; And shewing mercy unto thousands of them that love me, and keep my commandments.” Does this show that God is partial because he visits the inqiquity of the fathers upon the children unto the third and fourth generation, but shows mercy to a thousand generations? Do we have a contradiction here? This likely is hyperbole. Otherwise Moses has God counting out a literal four generations then stopping visiting the iniquity, and counting a literal thousand generations and stopping showing mercy. An absurdity. God is actually saying that He is a merciful God who shows mercy on all who repent, but punishes those who refuse to do so. Does God punish or reward the children, and grandchildren of sinful fathers and grandfathers? Would that not be unjust? God says in Ezekial 18:20, “The soul that sinneth, it shall die. The son shall not bear the iniquity of the father, neither shall the father bear the iniquity of the son: the righteousness of the righteous shall be upon him, and the wickedness of the wicked shall be upon him.” If the children continue the sins of their fathers, they will be punished just as the fathers. But if they do not continue in their fathers’ sins, they will not be punished. If they do so for a while, then repent, God will have mercy on them.
God is a just and impartial God. He rewards all who obey Him, or repent when they disobey, and punishes those who disobey Him and refuse to repent. After all, He sent his Son to die so that all might be forgiven (John 3:16; 2 Pet. 3:9). It is as Peter says in Acts 10:34-35, “Of a truth I perceive that God is no respecter of persons: But in every nation he that feareth him, and worketh righteousness, is accepted with him.”