“The letter kills, but the Spirit gives life.” (2 Corinthians 3:6)
The writers of Scripture were not legalists at heart, so when they quoted Jesus or another person, they often used the spirit, or essence, of what Jesus or that person originally said, without paying undue attention to the exact wording of that person’s sentence. Let’s take an example. The following quotes are of the same instance in which Jesus spoke concerning a person’s need to honor his father and mother. However, Matthew records Jesus as having said, “God commanded,” whereas Mark records Jesus as having said, “Moses said.”
 Matthew wrote that Jesus said: “For God commanded, saying, `Honor thy father and mother,’ and, `He that curseth father or mother, let him die the death.'” (Matthew 15:4)
 Mark wrote that Jesus said: “For Moses said, `Honor thy father and thy mother,’ and, `Whoso curseth father or mother, let him die the death.'” (Mark 7:10)
Which of the two quotes (above) is the correct one? Did “God command” or did “Moses say”? Is Matthew right, or is Mark? Did someone make a mistake? Are the Scriptures inaccurate? Well, if you know your Bible (this is the key part to understanding all Scripture), you will know that Moses was given divine authority by God, so that whatever he spoke under God’s leadership was the same as if God was actually saying it. In fact, Moses only spoke what God commanded him to speak (when he messed up, he was reprimanded severely). The answer, then, is that BOTH of these quotes are equivalent in terms of conveying the essential meaning of the passage, that we are to honor our father and mothers (even if they are not an exact word-for-word quotes of what Jesus actually said).
The writers of Scripture, then, were Christians at heart, who, without sacrificing truth, were interested in conveying their message in such as manner as to bring about a “change of heart-response” among their audience. They were not legalists at heart. They were not primarily into “head matters.” They knew that it was from the heart that flowed the “wellsprings of life” (Proverbs 4:23), so they paid attention to the essence of what was said, rather than to the exact words. They knew in their hearts what was meant when Jesus said something, even though they sometimes did not quote Him “word-for-word.” So, in wisdom, for example, because Matthew was not trying to reach out to Jewish people in his Gospel account, but rather to the common person who knew little about the Old Testament (and maybe had never even heard of Moses), he simply quoted Jesus as having said that, “Jesus said that God said.” This would have the desired effect upon his Gentile (non-Jewish) audience, without sacrificing the essential message of what Jesus was trying to get at.