The passage that Paul is quoting is from Deuteronomy 21:23…which deals with the punishment for those guilty of a capital offense. But Jesus was never guilty of anything other than loving us, and in doing so, He suffered the penalty and paid the price for our sinfulness. Jesus took the punishment we rightly deserved… so that we might be free.