It uses Google Cloud Messaging. There needs to be a server in between and I believe GCM is free. Consider a situation where Bobs phone is switched off. Alice sends a message and turns off their phone. Now, Bob turns in their phone. How do we get the message Alice sent to Bob?
Give me some open source code that I can run on my own server to manage the notifications for me and for my friends, and allow me to tell the client app on my phone to use it.
That's way better than forcing me to rely on a specific Google server and protocol, which further requires proprietary software on the client.
In addition to what @newjersey said, you also need to handle push notifications, which in the context of a mobile phone aren't cheap at all. This is because you need infrastructure and because keeping connections open drains your battery and making it work well is wasted developer effort. This is why it is better to use whatever is available, like GCM on Android, APNS on iOS, or maybe Pushy (see pushy.me) or whatever Amazon does if you want distribution on alternative stores.