“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 you” (Rom 6:17). What “doctrine” and to whom was it “delivered”? Not the Law, but the Gospel—to the believer. ​

“By “the form of doctrine,” is meant the Gospel, which is the “doctrine” of the Scriptures, of Christ and His Apostles and is sound and according to godliness; and is a "form," or contains a summary and compendium of truths and is a pattern or exemplar, according to which ministers are to preach and people to hear and receive. So the word {opwj} which is the same with {tupov} here, is used by the Jewish {y} writers for a form, copy, pattern, or exemplar of any sort of writings This form of doctrine is {hlbq}, "a Cabala," but not like that of the Jews' oral law, or form of traditions {z}, handed down, as they say, from one man, and set of men, to another; but this is delivered from the Father to Christ, from Christ to His Apostles and by them to the saints.

"Into which they were delivered," as it may be rendered, as into a mold; and so received the impression of it, and were evangelized by it: so such are who have a spirit of Gospel liberty (regenerate—grace), in opposition to a spirit of bondage (unregenerate—law); who live by faith on Christ, and not by the works of the law; who derive their comfort from Him, and not from anything done by them; whose repentance and obedience are influenced by the grace of God, and who are zealous of good works, without any dependence on them.

“This form of doctrine was "obeyed" by them, by which is meant, not a mere obedience to the ordinances of the Gospel; nor a bare hearing of the doctrines of it and giving an assent unto them; but an embracing of them by faith for themselves, so as to lay hold on Christ in them, submit to His righteousness therein revealed and be willing to be saved by Him and him alone, in His own way; and this is the obedience of faith: the reason why faith is expressed by obedience is because faith receives truth upon the veracity of God and not upon the dictates of carnal reason and is always more or less attended with external obedience to the will of God and that is rightly performed only by faith.

“This obedience did not lie in words, or proceed on mercenary views and in an hypocritical way but was "from the heart" and was real and sincere: and good reason there is why a hearty, cheerful and voluntary obedience should be yielded to the Gospel, since it is from God and Christ is the substance of it; it is truth and the word of our salvation. The Alexandrian copy reads, "from a pure heart"; and the Arabic version, "from the sincerity of your heart"; and the Ethiopic version, "with your whole heart." –JG

Obedience to God in the Gospel of Christ, which can only be done “from a pure heart (Christ),” was “the purpose of the commandment” (1 Tim 1:5) and is the result of being in the righteousness of Christ—through His obedience: “by one Man’s obedience many will be made righteous” (Rom 5:19). This is why “the righteousness of the Law” had to be “fulfilled in us” (Rom 8:4); not by us but by Christ.
Christ’s perfect (meaning out of divinity) obedience imputed righteousness; His sacrificial atonement imputed justification (salvation). It is not Christ’s perfect obedience to the Law which “is made unto us,” it is His “righteousness” (1 Cor 1:30), which was displayed by His obedience that is imputed to us. Therefore we are justified, not by His obedience but by His death, sacrificed for sin’s guilt; this brings us to the big question, “What is ‘the righteousness of the Law’ that is ‘fulfilled in us’ (Rom 8:4)?” The righteousness is the right which the Law possessed to invoke the death penalty for disobedience which is “the law of sin and death.” The law or principle for sin is still death (physically perpetuated by original sin and incurs a second death for the unregenerate—Rev 21:8) for sin (disobedience) against God.

The Father demanded the invocation of the death-for-sin law to man (Eze 18:4, 20) and was “fulfilled in us” by Christ (when we died with Him—Rom 6:5; Col 3:3); “the iniquity of us all” was “laid on Him,” (Isa 53:6) thus, not in Him (Heb 4:15). The closing question is, “Since God’s law required death for disobedience, why did Christ have to die for obedience? This is the “New Covenant in His blood” (Luke 22:20) made between the Father and the Son, in which Covenant man has no part—it being only between these Two. Man is just a recipient of this “Everlasting Covenant” which was made from eternity past. I like and accept the concept that according to Hebrews 13:20, 21 this Covenant involved the Father’s promise to His Son, that when (not if) He would die, He (Father) would raise Him from the dead to redeem mankind:

“Now may the God of peace who brought up our Lord Jesus from the dead, that great Shepherd of the sheep, through the blood of the everlasting covenant, make you complete in every good work to do His will, working in you what is well pleasing in His sight, through Jesus Christ, to whom be glory forever and ever. Amen.”​