But then going off Eddy's concern, what separates that from "do you want me to cook YOU for dinner?" Apart from the fact that I'm not a cannibal.
I will buy you... a present.
Without "a present", you'll be buying a person (I will buy you), a slave, a direct object. As soon as you say "buy you a present", you know you are not buying "you", like a slave, but "a present" (the direct object this time), and that present goes to you (the indirect object this time).
Quiero cocinarte... la cena.
Same thing: without "la cena", I'll be cooking you. After adding "the dinner", direct and indirect objects get swapped. Actually, in English is identical!!! How do you know that in "I am going to fry you an egg" you are not frying that person? These structures are totally identical in both languages.