The same reason that you'd be arrested for running an illegal taxi, but when Uber does it, it's fine. And the same reason that you'd be arrested for running an illegal hotel, but when AirBnB does it, it's okay.
Uber and AiBnb spend a lot of money lobbying governments at every level, and on marketing to make what they do seem acceptable.
If I impersonated Disney online and used their trademarks on my website, the FBI would raid my home, I'd be in prison and courts would bar me from ever touching a computer again.
Restaurants should be able to call the cops and report fraud, have it investigated and stopped, and have their cases passed on to federal authorities if necessary. This doesn't happen.
Youtube is more strange since they illegally hosted IP for a long while.
They still do, their ContentID system has a lot of holes.
If McDonald's were a mom & pop restaurant and you were a multi-billion dollar, VC-backed startup, then you can be sure McDonald's would not be able to do this so easily.
That's the difference.
Edit: Ah, yup - see link to eater.com post elsewhere in the thread
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.
How did they ever get into existence then, you may ask? Simple, VC money ...
The issue here is they agreed to allow GrubHub to pretend to be them. You'd never get that deal with McDonald's since they'd just not agree to it since they know it's a horrible idea but tons of people running restaurants don't understand they are getting a raw deal.
Sadly, that's false. GrubHub is a bad actor.
https://www.eater.com/2019/10/30/20940107/grubhub-to-add-res...
Suppose you want to go to McDonald's. I buy the McDonald's domain name. I put a credit card form on my site, and I "deliver" McDonald's to you. I charge a $40 surcharge for the privilege.
There is no way in hell that McDonald's would have to go begging at realmcdonald's.com because of my shenanigans. They'd have no patience for this bullshit. In real life they'd sicc a DMCA notice and a ton of lawyers on this and I'd lose my webhost and the sheriff would come visit me and who knows what else. They'd get McDonald's.com fast enough to make your head spin, and I'd be pushed out of that business.
Why is it different for restaurants?
Same problem: instead of me it's a company, and instead of McDonald's it's a small restaurant. But the principle is the same.
In domain name hijacking, it's presumed wrong because customers think they're reaching McDonald's when they're really calling me. In the GrubHub case it's exactly the same thing.
I don't understand why it's wrong when I do it, but it's not a problem GrubHub does. After all, McDonald's doesn't deliver, and I may own a very fine delivery business, but I'm still not allowed to coast off their name for my own business.