I believe that Matthew's account lists Jesus's cry from the ancient texts when he wrote "Eli, Eli lama sabachthani". This is not a quote from Psalm 22. The Hebrew in Psalm 22 is 'azab, not sabachthani. I've seen some stretches that try to link sabachthani with 'azab, but I believe it is a bit of a stretch. While I don't necessarily believe he was referring to the sabach plant, as do some who take the strictly Chaldean approach, the lamb of Genesis 22 was caught in a plant with thistles. Jesus could have easily had that occurrence (Isaac's offering) in mind as well as Psalm 22 when he called out from the cross. I also find it interesting that Mark records the words of Jesus as "Eloi, eloi...", a slight difference from Matthew's record. If we were to take a position that the Greek text as we have it was inspired by God, it begs the question, which Greek text?
The answer would be the entire Greek text of the New Testament.
Before digging into difficulty you have between Matthew and Mark's record of Jesus' death, we need to first point that both agree as to meaning of what Jesus cried out.
"And about the ninth hour Jesus cried out with a loud voice, saying, "Eli, Eli, lama sabachthani?" that is, "My God, My God, why have You forsaken Me?"" (Matthew 27:46).
"And at the ninth hour Jesus cried out with a loud voice, saying, "Eloi, Eloi, lama sabachthani?" which is translated, "My God, My God, why have You forsaken Me?"" (Mark 15:34).
Thus the only difference is in the spelling of "My God" in the transliteration of what Jesus cried out. First, we need to determine what language Jesus was speaking. An English transliteration of the beginning of Psalms 22:1 is 'eli 'eli lamah 'azavtani. An Aramaic translation of the same phrase transliterated into English would be elahi elahi lama shabachtani.
Noting that neither transliteration matches what is in our Bibles points out a difficulty in transliteration. Different languages sometimes have sounds that can't be directly represented in the letters of another language. What we are reading is a transliteration of the original language into Greek and then from Greek into English.
The last word, sabachtani shows us that Jesus was speaking Aramaic. shabach is the equivalent word to the Hebrew word 'azab. The thing is, Greek doesn't have a sh sound (the letter shin in Aramaic), so the nearest sound is the s sound of the Greek letter sigma, which is used. This was then transliterated into English as sabachtani.
Perhaps you wonder why two letters aren't used in Greek, like the English. The thing is that Greek has no h sound represented by a letter. You can get a rough approximation at the beginning of a word with a rough breathing mark, but definitely not at the end of a word. That is why lamah becomes lama in a Greek transliteration. By the way, Hebrew and Aramaic are very similar languages. In both languages, the word lamah have the same meaning. Even more difficult is that both Hebrew and Aramaic have two h sounds. One, from the letter he sounds like the English h, but the other from the letter chet has no English equivalent. The nearest we have is the sound you get at the end of the word "loch." The problem is that in English we pronounce ch with various sounds depending on its position in a word and the vowels that are next to it. The Greek does have a letter that sounds close to chet, which is the letter chi.
Next, we need to understand that dictionaries did not exist in those days. People generally spelled words as they sounded. Some letters, especially vowels can be debated as to which is the closest sound in another language, so though we might assume that elahi would be spelled elai in Greek (remember there is no general h sound in Greek), we don't know exactly how the ah sound was pronounced in those days. Omega could well be the closest approximation as rendered in Mark.
Finally, we must realize that people don't always pronounce their words distinctly. This causes dialects to appear. For example, in the English word herb is pronounced erb in America even though in England the leading h is sounded. Greek, for instance, commonly drops a vowel when one word ends in a vowel and the next word begins with a vowel. The process is called "elided." We don't know the dialect that Jesus spoke. It is possible, and even likely that center vowel in elahi was weak or even dropped in his dialect. One reason to suspect this is because it was a Jewish region and the Hebrew word for "my God" is eli. So people who spoke both Hebrew and Aramaic would naturally have a tendency to blend toward a similar sound.
We must also note that Jesus was hanging on a cross. It is difficult to breathe while on a cross. That alone could cause some blurring of the way words are pronounced.
It is an assumption, but not a far fetched one. If we grant it, then Matthew recorded the words as they were pronounced giving his readers understanding as to how people misunderstood Jesus to be calling for Elijah. In other words, Matthew showed the dialect. Mark recorded the words as they were commonly transliterated in his day. In other words, Mark showed the language used. But both give us the same statement with the same meaning.