The Israelites were not to punish children for the crimes their parents committed. To do so charged them with guilt unjustly.
". . . it was a common thing among heathen nations--e.g., the Persians, Macedonians, and others--for the children and families of criminals to be also put to death (cf. Esther ix. 13, 14 . . .)."275
In the cases where God executed the families of criminals He may have done so because the family members were also responsible for the crime (v. 16; cf. Josh. 7:24-26). In any case God has the right to do things that He does not allow His people to do. It is one thing for children to suffer physically and socially because of their parents' sins (Exod. 20:5; Deut. 5:9). It is something else for human authorities to punish them for criminal acts that they have not committed.