“Make me a sandwich” is an interesting sentence, the subject of a classic grammar joke. It is so because of the way it can be interpreted. To most people, it is a simple statement. But to some, it can mean two things – “make a sandwich for me”, and “make me into a sandwich”. Why is it so? This can be cleared with two concepts – Ditransitive verb and Resultative verb.
A ditransitive verb takes two objects. A direct object is the one that undergoes the action. And indirect object comes before the direct object and is the one that benefits from the action, or is the one that the action is intended for.
A resultative verb takes a direct object that undergoes the action, and an object compliment that comes after the object and describes how the object ends up. Object complements can be words or phrases, and mostly adjectives are used as object complements, but a few resultative verbs allow the use of noun phrases as well.
Ditransitive: Make (verb) me (indirect object) a sandwich (direct object).
Resultative: Make (verb) me (direct object) a sandwich (object complement).
Assigning grammatical functions in the first manner implies the meaning that people usually have in mind when they say it, while assigning grammatical functions in the second manner brings out the classic grammar joke.
Both interpretations are grammatically correct, and there will always be phrases and sentences with multiple meanings. For example, instead of saying “make me a sandwich”, if you say, “make a sandwich for me”, what do you mean – “Make a sandwich for me to eat”, or “I’m too busy right now to make a sandwich for our child, so could you do that for me”?