That’s why MaxMind charges for more accurate data. It requires actual effort...
Just because it requires effort does not mean it can't be done in an open source way.
2) IP Spidering via traceroutes / RIPE/etc data.
3) Agreements with third parties that have IP/Address mapping due to data supplied from users. [least accurate]
That'd be my guess anyway.