Then when he says, but thanks be to God, he shows the folly of obeying sin and thereby returning to the slavery of sin: first, by considering the benefit we have received. For if someone, by another's graciousness is freed from slavery, it is unfitting to subject oneself freely to slavery. Hence, since we have been freed from sin by the grace of God, it is unfitting willfully to return again to the slavery of sin.
Second, by considering the state into which we were led after freedom from sin, namely, that we are slaves to justice. But, it is not lawful for a slave to subject himself to the dom...inion of an opposite master; hence, it is not lawful, if we have been made slaves of justice, to return to the slavery of sin.
The Apostle touches on both of these considerations, when he says: I thank God, and you too should thank God, that you were the servants of sin, because he who commits sin, is a servant of sin (John 8:34), but have obeyed, namely, by believing: for obedience to the faith, in all nations (Rom 1:5); and this not as though compelled, but from the heart: for with the heart, we believe unto justice (Rom 10:10), unto that form of doctrine, i.e., to the doctrine of the Catholic faith: follow the pattern of the sound words you have heard from me (2 Tim 1:13), into which you have been delivered: i.e., gave yourselves entirely: but first they gave themselves to the Lord and to us by the will of God (2 Cor 8:5). And by this being then freed from sin, so that it is not fitting to desert justice: you were bought with a price (1 Cor 7:23) and are not your own.
Source: Commentary on Romans