In this seemingly straightforward verse, God defines sin (hamartia) as anomia, rendered "lawlessness" (NKJV, RSV, NIV, REB, NAS) or "the transgression of the law" (KJV). Other translations use the words "evil" (Peshitta), "a breaking of God's law" (Phillips) and "iniquity" (Diaglott). The Greek word anomia literally means "being without law." To get a sense of what John writes, we can express it as, "Whoever does hamartian also does anomian, and hamartia is anomia."
The King James and Phillips versions imply that sin is strictly the breaking of God's law, whereas the other translations consider it more generally. However we may understand it, John certainly implies God's involvement as both Lawgiver and Judge. God will judge each person according to the standards expressed in His law.
In I John 3:4, John argues against the Gnostic idea that the things done in the body are inconsequential because only the spirit counts. Gnostics following this school of thought often fell into licentiousness. Some in John's area of ministry seem to have believed that they could not sin in their flesh. Since their flesh, matter, was ultimately evil anyway, it could not be redeemed and was worthless. Thus, they concluded, anything done in the flesh had no bearing on one's salvation.
They played a semantic game with the words hamartia (sin) and anomia (lawlessness). They considered hamartia to identify the transgressions of moral law, particularly sins of the flesh, such as sexual immorality, gluttony, drunkenness, and stealing. Anomia, however, categorized sins of the spirit, like rebellion, pride, vanity, and greed—the sins that Satan committed. They believed God, the eternal Spirit, would look the other way if one committed hamartia, but committing anomia put one under judgment.
They also made no connection between them; they did not recognize that one could affect the other. Gnostics would not admit that sins of the flesh had their origins in the mind (James 1:14-15) or that such sins could in turn cause their character, their spirit, to degenerate (Jeremiah 7:24). They saw a total and irreconcilable separation between flesh and spirit.
Thus, John tells them hamartia and anomia are the same; they are both sin! It does not matter to God whether the sin is committed in the flesh or in the spirit—to Him it is sin! If God says not to do something, and we do it, it is sin. He has said not to eat pork and shellfish; if we do, it is sin. He has said not to commit sexual immorality; if we do, it is sin. He has said not to hate our brother; if we do, it is sin. He has said to keep the Sabbath; if we do not, it is sin!