Simplest answer -- Devarim is prohibiting us from carrying out such a punishment (as was common in cases of treason, as the son would likely take up the challenge to the throne); Hashem can operate with different calculus.
From Rabbi Shmuel Goldin,
*A few thought on what is a very difficult subject
Of course, our first reference would be to the rabbinic teaching that פקד עון אבות refers to situation where the children continue the sin of their fathers.
The question that raises, however, is that they are being punished for their own sins-not their “fathers’ sin”-In that case, ...