The intent behind the law

Commandments 6-8 (murder, adultery & theft) are about living in a fair, just and covenantal community.  “The sixth through eighth commandments present general prohibitions not to murder (5:13), commit adultery (5:14), or steal (5:15). In doing so, they set minimum standards for Israel to be a just society and indicate the context in which the people will be called further to be holy and to love the Lord with their all their heart, soul, and might (Deut. 6:4–9), and their neighbors with goodwill and generosity (Lev. 19:18). Thus, while the prohibition against stealing is a basic principle of justice in Israel’s national life, the people are called to do more than refrain from taking another person’s possessions. They are to embody the Lord’s love for them by loving the stranger and sojourner as themselves (Lev. 19:33–34). When Jesus refers to the law in the Sermon on the Mount (“you have heard that it was said,” Matt. 5:21ff.), he is correcting not the intended purpose of the OT law but the mistaken presumption that these laws (or their interpretation) were meant to be exhaustive of what it meant to live as a child of the kingdom of heaven. (E.g., as Jesus made clear, simply refraining from murder does not fulfill the law when a person disdains his brother as a fool; or simply refraining from adultery does not fulfill the law when a man lusts after a woman; see Matt. 5:21–24, 27–28; and note on Matt. 5:21–48.).”  From the ESV Study Bible.