“But God be thanked, that ye were the servants of sin, but ye have obeyed from the heart that form of doctrine which was delivered unto you.”
This verse should be better read thus:  “But thanks be to God that, although ye were the servants of sin, nevertheless ye have obeyed from the heart that form of doctrine that was delivered unto you; or, that mold of teaching into which ye were cast.”  Understand that Paul is not thanking God that they were sinners; but he is thanking God they had now received and obeyed the Gospel

         “But God be thanked”
        Literally:  “But thanks {be} to God.”   This is a typical Pauline expression.

Paul is making a direct appeal to the feelings of the Roman Christians, and is giving him a ground of gratitude to God that they had become obedient to Christ.   He thanks God that his readers have already made their choice for obedience to God and that they have received the Gospel.

         “that ye were the servants of sin”
         Literally: “That you were slaves of sin.”–Paul is rejoicing that this is a state of things of       for them is now in the past.

Keep in mind that the stress is on the “were.”  He is recounting the fact that they had been in bondage to sin; that they had been completely its slaves.  Christians should thank God that though once were great sinners, but now have been converted.  Also, when others who are great sinners are converted, they should give praise to Him.

         “but ye have obeyed from the heart”
         Literally: “But you obeyed from {the} heart.”  Meaning as a sincere and complete service; for no other obedience is real.

“the form of doctrine”
Literally: “The type of teaching” (i.e., the Gospel).  The form of doctrine means the kind or sort of instruction which was communicated to you. Paul is praising them that they have   yielded obedience to the instructions or teaching given to them.

                 DOCTRINE:  (Grk.–didachēs)–The word “doctrine” simply means instruction; i.e., that which is taught.  

“which was delivered unto you”
Literally: “To which you were delivered.”–Here their conversion is pictured as a mold, or die, into which they were cast, and from which they took the impression of its excellence. 

         DELIVERED: (Grk.–paradidōmi)–This has reference to the melting of metal; which, when it is liquified, is cast into the mold, that it may receive the impression that is sunk or cut in the mold; and therefore the phrase may be literally translated, “into which mold of   doctrine you have been cast. “

The figure upon this die is the image of God, which was stamped on their souls when they believed the Gospel and received the Holy Spirit. They were melted down under the preaching of the Word, and then were capable of receiving the stamp of its purity.

“Being then made free from sin, ye became the servants of righteousness.”

If Paul seems to be repetitive it is only because he believes that what he was teaching is so important.  In this verse Paul is again reminding his readers in Rome that they had broken free from the slavery of sin and become the willing servants of righteousness.

“Being then made free from sin,”
Literally: “But having been set free from sin.”– That is, made free from the slavery of sin.   They were made free, i.e., (manumitted) as a slave is who is set at liberty and is no longer under obligation to obey his former master.    

Here we see Paul making another personification: he personifies both sin and righteousness.  Sin can charge no good and profitable work, while righteousness can require none that is unjust or injurious.

         HAVING BEEN SET FREE:  (Grk.–eleutherothentes)This refers to the manumission (freeing ) of a slave. Paul is emphasizing to these Roman believers that they were redeemed from the slavery of sin, and became the servants of righteousness

Being then made free from sin–But not freed from a sinful nature; or from a corrupt heart; or from vain thoughts; or from sinful words.  Paul is not saying they were set free from sinful actions altogether; but rather from the damning power of sin.  He has already pointed out that sin has brought all men under a sentence of condemnation.

“ye became the servants of righteousness”
Literally: “You were made slaves to righteousness.”–You came under the dominion of righteousness; you yielded yourselves to it; and are therefore bound to be holy.     Understand that there is no absolute independence for man, because our very nature requires us to serve some master.

         “You were made slaves to righteousness.–You have changed masters; you are no longer slaves of Sin (set free from that tyrant), and now you are willing servants of righteousness. There is no middle ground here; no “no man's land” in this war. 
         This basically describes the action of apolutrosis; a word that means “to liberate by the payment of a ransom in order to set a person free.”  Basically speaking, apolutrosis means not only to go into the slave market and put down the payment, and not only to take the purchased slave out of the market for one’s own private us, never to sell it to anyone else; but it also means to set the slave free or to liberate him after paying the purchase price. Simply put, this means buying a slave out of slavery in order to set him free; and this describes our redemption..   In Roman times there was a group of charitable women who would go down to the slave markets and buy out slaves for the sole purpose of setting them free.  Christ Jesus came down here to the “slave market of sin” (this sin polluted earth) and paid the price (His own blood) to purchase us out of sin and to set free all who trust in Him.

“I speak after the manner of men because of the infirmity of your flesh:  for as ye have yielded your members servants to uncleanness and to iniquity; even so now yield your members servants to righteousness unto holiness.”
Free Translation:  “I am speaking to you in human terms on account of your difficulties of apprehension, or the weakness of your human nature; for as you presented or yielded your members as slaves for the practice of impurity and lawlessness, even so now present your members as servants to righteousness.”

Paul now goes on to put the Romans in mind of their past state of sin, and of their present state by grace. 

“I speak after the manner of men”
Literally: “I speak as a man.”--I speak after the manner of men and repeat these familiar illustrations as men do when they must adopt their discourses to the limitation of their hearers

           I SPEAK AFTER THE MANNER OF MEN:   (Grk.–anthrôpinon legô)– Literally:  "I speak a human word.”  Paul is begging his readers pardon for using metaphors to illustrate what he is attempting to get across to them. See 3:5; Gal. 3:15 where he uses the Greek term, kata anthrôpon–which is, “after the manner of men” or, “I speak as a man.”

This phrase is often used by the Greek writers to signify what was easy to be comprehended; what was, to use the popular Latin term of Paul’s day, ad captum vulgi, (which means: “level with common understandings”).  

“because of the infirmity of your flesh”
Literally: “Because of the weakness of your flesh.”  The weakness of your spiritual apprehension. Your slowness of understanding flows from the weakness of the flesh, that is, of human nature.   

         Because you are “weak” to apprehend spiritual truth, because you are still “in the flesh;” perhaps either meaning that they are “worldly” or still spiritually immature.  Either is probably. This is Paul’s reason for going so low for his metaphor; for boldly depicting their state of justification as one also of slavery.
         Paul is not reproaching anyone for moral railings in this context.  He is simply acknowledging a reality that encroaches on all those who are descended from
Adam.  Human beings need illustrations that are partial and imperfect since our minds cannot grasp truth without them.

                 INFIRMITY:  (Grk.–asthenian)–This word means weakness, feebleness; and is opposed to rigor and strength.

         “your flesh”– This corresponds nearly to what is elsewhere called “the carnal mind,” a mind alive only to material and sensible things.

          FLESH:  (Grk.–sarx)–This word is often used to denote the corrupt passions of men; but it may refer here to their intellect, or understanding. Your dullness, on account of your remaining carnality, in rightly apprehending divine truth. 

         “for as ye have yielded”
         Literally: “For as you presented.”–The thing being viewed as now past. As they had been servants of sin in its various forms. 

As they had before employed their bodies in the practice of sin, but now they should employ them in the practice of holiness.

         “servants to uncleanness”
         Literally:  {As} slaves of impurity.”–You previously were in bondage to all forms of impurity.

          UNCLEANNESS:  (Grk.–akatharsiai)—The    word uncleanness here refers to impurity of life in any form; to the degraded passions that were common among the heathen.

In particular Paul is referring to homosexuality, which was a form of sin to which the Gentiles (especially the Greeks) were addicted. This is a grose sin against man’s own self and others who are accomplices in it commission.

“and to iniquity”
Literally:  “And  to lawlessness.”–That is, transgression of law; lawlessness—another form of sin, but a sin that is more directly against God; i.e., rebellion against God.  Iniquity is often used for willfully repeated sin.  “I know its wrong, but I’m gonna do it anyhow.” 

INIQUITY:  (Grk.–anomiai)—Literally:  “lawless acts.”

now yield your members servants to righteousness unto holiness.”
Literally:  “Now yield your members as slaves to righteousness unto sanctification.”–Now that you are born-again in Christ.  In order to practice holiness, let the surrender of your members to holiness be as sincere and as unqualified as their surrender was to sin.

This is what is required of all Christians. Before conversion they were wholly given to sin; after conversion they should be wholly given to God.  If all Christians would employ the same energies in advancing the kingdom of God that they have in promoting the kingdom of Satan, the church would rise with dignity and grandeur, and every continent and island would soon feel the movement.

       YIELD:  (Grk.–parastesate)-Lliterally: “present.”  Paul is exhorting the believers to yield their members as servants to righteousness.

                 RIGHTEOUSNESS:  (Grk.-hagiasmon)–Better rendered as, “sanctification,”  which is a word that denotes that which is set aside for God’s use.

“For when ye were the servants of sin, ye were free from righteousness”

         “ye were servants of sin”
         Literally: “You were slaves of sin.”–That is, in your former state, you were not at all under the influence of righteousness.

         Therefore, you now ought to be free from unrighteousness; meaning to be as uniform and zealous in serving God as ye were in serving the devil.  It is reasonable that now you ought to be free from unrighteousness; but now you ought to be just as zealous in serving God as you were in serving the devil. 
         The argument which is implied here is that now they ought to be equally free from sin, since they had become released from their former bondage, and had become the servants of another Master.  These two servitudes are totally incompatible.  If we cannot serve God and Mammon, surely we cannot serve Christ and Satan.

      Be ye not unequally yoked together with unbelievers  for what fellowshiip hath rightedousness withunrighteousness?  And what communion hath light with darkness.   
       And what concord hath Christ with Belial?  Or what parth hath he that believeth with an infidel?
        And what agreement hath the temple of God with idols?  For ye are the temple of the living God, as God hath said, I will dwell in them and walk in them, and I will be their God and they shall be My people ”–(II Cor. 5:14-16).

  While you were in the service of Sin, you were in no proper sense the servants of Righteousness, and never did it one act of real service; your real services were all and always given to Sin.  But now things have changed for you.  Your whole manner of living and serving has taken a 180 degree change.