Devices that ship with Google's Play Store and other apps installed must pass Google's Android “Compatibility Test Suite”. Rooting a device or installing a custom ROM prevents a device from being “CTS Compatible”. This is how the SafetyNet API can tell if you're rooted–it merely checks for CTS compatibility. Similarly, if you get an Android device that never came with Google's apps–like one of those $20 tablets shipped direct from a factory in China–it won't be considered “CTS compatible” at all, even if you haven't rooted it.
