It's quite clear that the Bible says the fathers are not to be punished for the son's sins and the sons not to be punished for the father's sins.† However, through out the Old Testment we see that when a king sinned, because either they repented or because of a prior promise to their fathers that the punishment came on the people in later generations.† One specific example would be King Hezekiah as written in II Chronicles 32:24-26.† In verse 26 "Then Hezekiah repented of the pride of his heart as did the people of Jerusalem; Therefore, the Lord's wrath did not come upon them during the days of Hezekiah."††I'm reading this†as the sons of Hezekiah bore the consequences / punishment of Hezekiah's sin.† I see a contradiction here.††One can say that consequences and punishments are two different things but I don't see the difference.† Punishment is a consequence of sin and if the father sins and the son gets the consequence then the son is bearing the punishment†for the father.†
You missed a vital fact. The sins which were being punished were not the king's alone.
"Zedekiah was twenty-one years old when he became king, and he reigned eleven years in Jerusalem. He did evil in the sight of the LORD his God, and did not humble himself before Jeremiah the prophet, who spoke from the mouth of the LORD. And he also rebelled against King Nebuchadnezzar, who had made him swear an oath by God; but he stiffened his neck and hardened his heart against turning to the LORD God of Israel. Moreover all the leaders of the priests and the people transgressed more and more, according to all the abominations of the nations, and defiled the house of the LORD which He had consecrated in Jerusalem. And the LORD God of their fathers sent warnings to them by His messengers, rising up early and sending them, because He had compassion on His people and on His dwelling place. But they mocked the messengers of God, despised His words, and scoffed at His prophets, until the wrath of the LORD arose against His people, till there was no remedy. Therefore He brought against them the king of the Chaldeans, who killed their young men with the sword in the house of their sanctuary, and had no compassion on young man or virgin, on the aged or the weak; He gave them all into his hand" (II Chronicles 36:11-17).
What you see is that while God's wrath was mounting, He was willing to delay the inevitable because every once in a while a leader of the people turned to God. He delayed the destruction because Hezekiah repented, though God warned Hezekiah it would mean that his descendants would suffer as a result of Hezekiah's foolish actions. In Josiah's day, God also held off the destruction because Josiah was such a good king.
"Then she said to them, "Thus says the LORD God of Israel, 'Tell the man who sent you to Me, "Thus says the LORD: 'Behold, I will bring calamity on this place and on its inhabitants - all the words of the book which the king of Judah has read - because they have forsaken Me and burned incense to other gods, that they might provoke Me to anger with all the works of their hands. Therefore My wrath shall be aroused against this place and shall not be quenched.'"' But as for the king of Judah, who sent you to inquire of the LORD, in this manner you shall speak to him, 'Thus says the LORD God of Israel: "Concerning the words which you have heard - because your heart was tender, and you humbled yourself before the LORD when you heard what I spoke against this place and against its inhabitants, that they would become a desolation and a curse, and you tore your clothes and wept before Me, I also have heard you," says the LORD. "Surely, therefore, I will gather you to your fathers, and you shall be gathered to your grave in peace; and your eyes shall not see all the calamity which I will bring on this place."'" So they brought back word to the king" (II Kings 22:15-20).
These good kings won their people reprieves, but the people continued to sin and the eventual doom did fall on them.
But you are incorrect, punishment and consequences of sin are not the same thing. A man might get drunk, drive a car, plow into another car and kill the people in that car. The death of the people was a consequence of the man's sins. His time in jail is the punishment for his sins.
David sinned with Bathsheba. He repented of his sins and was forgiven, but he was also told that his sins would lead to consequences, which included Absalom's rebellion.
Because Hezekiah showed off the treasures of Israel to Babylon, he could have brought destruction on himself and the people in his day. It was because Hezekiah repented that God did not punish him for his foolishness. However, the consequences of Hezekiah's action would haunt his descendants. What I find particularly sad is that this didn't bother Hezekiah that much. He was just happy the consequences would not come in his own lifetime. But notice that Josiah, a descendant of Hezekiah, gain further reprieve by his good behavior. The reason Jerusalem was destroyed was because of all the bad kings, priests, and people who chose to do wrong. The reigns of Hezekiah and Josiah were just temporary pauses in a long downhill rush into chaos.
Many times we are ignorant of the chain reaction we set off by our actions.
"An astonishing and horrible thing has been committed in the land: The prophets prophesy falsely, and the priests rule by their own power; and My people love to have it so. But what will you do in the end?" (Jeremiah 5:30-31).
You mentioned the sins of David and Bathsheba, which then brought up another question for me. Would you say that losing their baby was both a punishment and a consequence? Punishment because the death of the baby brought them grief and consequence because the baby was the result of something that was not pleasing to God.
"Then David said to Nathan, "I have sinned against the LORD." And Nathan said to David, "The LORD also has taken away your sin; you shall not die. "However, because by this deed you have given occasion to the enemies of the LORD to blaspheme, the child also that is born to you shall surely die"" (II Samuel 12:13-14).
The death of the child was a consequence. God said that if the child lived, the enemies of God would have an occasion to blaspheme God. Blasphemy is purposeful slander of another person's character. It was David who sinned, but the enemies of God would claim that God allowed David to take another man's wife and profit from it. Perhaps if the child lived, David would have wanted to put him on the throne of Israel -- after all he did put Solomon on the throne who was David and Bathsheba's second son.
To David, the child's death was also a punishment because he did not want the child dying because of his sin.