If they can't understand why something is wrong, then pain isn't going to help them. Basically, that means that children don't know right from wrong unless they are trained to fear a painful outcome to their actions. If they aren't mature enough to be able to predict what will result in a spanking, it would just seem random to them.
I don't think that is true. If a kid can understand 'oh, if I do this, I'll get spanked' then they can understand why it is wrong just as easily, and if they can't, then they really can't be held accountable for their actions.
From what I understand the brain isn't fully ready to think in those terms yet. The human brain still has a way to go. They can think short term cause and effect though at a certain age. For example, if I throw a toy on the ground, someone will pick it up for me? They learn to connect dots at every stage.
But their reasoning isn't as big as to think why something is wrong all the time. They can think more in terms of allowed and not allowed. But "wrong" I just don't know how deep that can go. And the wrongs may or may not make any sense to them in the first place. What is right or wrong to one person may not be to another. That is a reason why I think US court systems have a different set of rules for underage children. Their systems of rules and reasoning just isn't all there yet.