Your second sentence does not sound totally natural, and it does not mean the same thing as the first sentence.
As a native speaker, I understand your second sentence to mean either:
He gives a present [intended] for me [to someone else]
He gives a present [on my behalf] [to someone else]
The phrase "for me" either modifies:
"present," to describe the final intended recipient of the present.
"gives," to indicate that he gives the present because I cannot (he does this for me)
Consider similar uses of for:
I have two presents: one is for Bob and the other is for Alice. Because you will see Alice on her birthday, I will give the present for Alice to you.
I cannot come to her birthday party. Can you give the present to her for me?
Although I can parse the sentence, your second sentence still seems strange because it doesn't say whom you give the present to, which is a necessary part of the act of giving.