Not sure how to explain this. I have a Chinese and an MI box. Is the MI android made by Google while the Chinese android just a cheap software? How is it legal to copy the software like that? Are they both the same android? Why is the Chinese version not built for TV and always so sluggish?
There's enough open source components that it's possible to have nearly identical Android TV OS on the cheap boxes, so there really isn't a legality issue there. (Though many boxes do still just use adapted Androd ROMs with generic TV launchers). Remember, Android is meant to be a (mostly) open platform. Google has no issues with generic companies trying to do their own thing (some of them predate Google TV, which was the forerunner of Android TV). At the same time, they do want to have a clear platform of boxes that meet certain expectations, hence why only certain companies are able to officially be "Android TV".
The biggest differences are quality/support (normally... wtf Razor), Chromecast support (can't be duplicated in software as it needs to be authorized by Google's severe), and support for various DRM frameworks. Google has a high bar to be an official Android TV manufacturer, so there's also a baseline for certain video codecs supported, and other little things.
So while the generics can get close, the remaining difference can make a very big impact.