I think I remember reading that they often set all of this up prior to speaking with the owner / without getting their approval and then basically go to them after the fact and say "look how much traffic we've been bringing in for you"
Edit: Ah, yup - see link to eater.com post elsewhere in the thread
Except now grubhub et all basically controls their web presence through vastly superior SEO, and if they don't agree to grubhub's terms, they basically disappear off the internet.
It did cost them money to spoof an unknowing client, but they make money having a credit card form collecting fees before anyone else knows whats going on.
Reselling is generally legal. There are no particular trademark concerns when it's ultimately the genuine goods getting to the consumer at a different price.
It's very easy to understand why consumers and businesses would be annoyed by this behavior, though, and it may be deceptive or immoral in other ways.
Edit: Ah, yup - see link to eater.com post elsewhere in the thread