This question has been much debated and will not be settled here. So, let me confine my answer to the Biblical data concerning prepositions before the Greek word ὄνομα (onoma = "name").
διὰ [τὸ] ὄνομά = through/because of/on account of the name
- Matt 10:22 - And you will be hated by all on account of the name of Me; but the one having endured to the end, he will be saved.
- Mark 13:13 - And you will be hated by all on account of the name of Me; but the one having endured to the end, he will be saved.
- Luke 21:17 - And you will be hated by all because of the name of Me.
- John 15:21 - But they will do all these things against you on account of the name of Me, because they have not known the One having sent Me.
εἰς [τὸ] ὄνομα = in the name
- Matt 10:41 - The one receiving a prophet in the name of a prophet will receive the reward of a prophet, and the one receiving a righteous man in the name of a righteous man will receive the reward of a righteous man.
- Matt 10:41 - And whoever shall give to drink to one of these little ones only a cup of cold water in the name of a disciple, truly I say to you, he shall certainly not lose his reward."
- Matt 28:19 - Therefore having gone, disciple all the nations, baptizing them in the name of the Father, and of the Son, and of the Holy Spirit
- John 1:12 - But as many as received Him, He gave to them authority to be children of God--to those believing in the name of Him
- John 2:23 - And when He was in Jerusalem in the Passover, in the Feast, many believed in the name of Him, beholding His signs that He was doing.
- John 3:18 - The one believing in Him is not judged, but the one not believing already has been judged, because he has not believed in the name of the only begotten Son of God.
ἐπὶ τῷ ὀνόματί = in/on/upon/unto the name
- Matt 18:5 - And whoever shall receive one such little child in the name of Me, receives Me.
- Matt 18:20 - For where two or three are gathered together unto My name, there am I in their midst."
- Matt 24:45 - For many will come in the name of Me, saying, 'I am the Christ,' and they will mislead many.
- Mark 9:37 - "Whoever shall receive one of such little children in the name of Me, receives Me; and whoever shall receive Me, does not receive Me, but the One having sent Me."
- Mark 9:39 - And Jesus said, "Do not forbid him. For there is no one who will do a work of power in [the] name of Me, and will be able readily to speak evil of Me.
- Mark 13:6 - Many will come in the name of Me, saying, 'I am He,' and they will mislead many.
- Luke 1:59 - And it came to pass on the eighth day, they came to circumcise the child, and were calling it after the name of his father, Zechariah.
- Luke 9:48 - and He said to them, "Whoever shall receive this child in the name of Me, receives Me; and whoever shall receive Me, receives the One having sent Me. For the one being least among you all, he shall be great."
- Luke 21:8 - And He said, "Take heed, lest you be led astray; for many will come in the name of Me, saying, 'I am He,' and 'The time is drawn near.' Do not go after them.
- Luke 24:47 - and repentance and forgiveness of sins to be proclaimed in the name of Him to all nations, having begun from Jerusalem.
- Acts 2:38 - And Peter says to them, "Repent and be baptized, every one of you, in the name of Jesus Christ for the forgiveness of your sins, and you will receive the gift of the Holy Spirit.
- Acts 4:17 - But that it might not spread further on among the people, let us warn them to speak no longer to no-one in the name of this [man]."
- Acts 4:18 - And having called them, they commanded them not to speak nor to teach at all in the name of Jesus.
ἐν [τῷ] ὀνόματί = in/on the name
- Matt 21:9 - And the crowds going before Him and those following were crying out, saying: "Hosanna to the Son of David!" "Blessed is the One coming in the name of the Lord!" "Hosanna in the highest!"
- Mark 9:38 - John answered Him, "Teacher, we saw someone who does not follow us casting out demons in the name of You, and we were forbidding him, because he was not following us."
- Mark 9:41 - For whoever might give you to drink a cup of water because you are Christ's in name, truly I say to you, that he shall certainly not lose his reward.
- Mark 11:9 - And those going before and those following were crying out: "Hosanna!" "Blessed is the One coming in the name of the Lord!"
- Mark 16:17 - And these signs will accompany those having believed: In the name of Me they will cast out demons; they will speak with new tongues;
- Luke 9:49 - And John answering said, "Master, we saw someone casting out demons in the name of You, and we were forbidding him, because he does not follow with us."
- Luke 10:17 - And the seventy-two returned with joy, saying, "Lord, even the demons are subject to us through the name of You."
- Luke 13:35 - Behold, your house is left to you. And I say to you, you shall not see Me until the time comes when you say, 'Blessed is the One coming in the name of the Lord.'"
- Luke 19:38 - saying: "Blessed is the King who comes in [the] name of the Lord!" "Peace in heaven and glory in the highest!"
- John 5:43 - I have come in the name of the Father of Me, and you do not receive Me; if another should come in the name of his-own, you will receive him.
- John 10:25 - Jesus answered them, "I told you, and you do not believe. The works that I do in the name of Father of Me, these bear witness concerning Me.
- John 12:13 - took the branches of the palm trees and went out to meet Him, and were shouting: "Hosanna!" "Blessed is the One coming in [the] name of the Lord!" "And the King of Israel!"
- John 14:13 - And whatever you might ask in the name of Me, this I will do, so that the Father may be glorified in the Son.
- John 14:14 - If you ask Me anything in the name of Me, I will do it.
- John 14:26 - But the Helper, the Holy Spirit, whom the Father will send in the name of me, He will teach you all things and will bring to your remembrance all things that I have said to you.
- John 15:16 - You did not chose Me, but I chose you and appointed you, that you should go and you should bear fruit, and your fruit should remain, so that whatever you might ask the Father in the name of Me, He may give you.
- John 16:23 - And in that day, you will ask of Me nothing. Truly, truly, I say to you, whatever you may ask the Father in the name of Me, He will give you.
- John 16:24 - Until now you have asked nothing in the name of Me. Ask and you will receive, that your joy may be full.
- John 16:26 - In that day you will ask in the name of Me, and I do not say to you that I will implore the Father for you.
- John 17:11 - And I am no longer in the world, and yet they are themselves in the world, and I am coming to You. Holy Father, keep them in the name of You, which You have given Me, that they may be one as we are.
- John 17:12 - When I was with them, I was keeping them in the name of You, which You have given Me. And I guarded them, and none of them has perished, except the son of destruction, that the Scripture might be fulfilled.
- John 20:31 - But these are written so that you may believe that Jesus is the Christ, the Son of God, and that by believing you may have life in the name of Him.
- Acts 3:6 - But Peter said, "Silver and gold, to me there is none; but what I have, this I give to you: In the name of Jesus Christ of Nazareth, rise up and walk!"
- Acts 4:10 - let it be known to all of you, and to all the people of Israel, that in the name of Jesus Christ of Nazareth--whom you crucified, whom God raised out from the dead--in Him this man stands before you sound.
From this survey we observe the following facts:
- Several of these prepositions appear (in this context) to be used interchangeably such as ἐν vs ἐπὶ (Mark 9:37, 38, 39, 41); see also Luke 9:48 vs Luke 9:49; and Acts 4:10 vs $;17, 18.
- The prepositions ἐπὶ and εἰς are sometimes used interchangeably (as the OP has observed) in places like Matt 28:19 and Acts 2:28.
- Further, the meanings of these prepositions overlap considerably and that is why they are often used interchangeably.
In a few places, a preposition is completely absent and the article acts in its place such as:
- Acts 2:21 - And it shall be that everyone who shall call upon the name of the Lord will be saved.'
- Acts 3:16 - And on the faith in His name, this man whom you see and know, His name has strengthened; and the faith which is through Him has given to him this complete soundness before all of you.
Many have tried to make very fine distinctions between the use of these prepositions such as, "on the subject of" vs "in the authority/power of", etc. However, it appears that the NT writers at times almost deliberately blurred these differences (if any really exist). Thus all that one might conclude is that invoking the name of God, the Father or Jesus simply means to act on/by their authority and teaching.
[BDAG has an extended article about this subject of the "the name" under ὄνομά which I have summarized in the brief statement above.]