In most cases, their database is entirely free as in free beer. You can't modify and contribute back to it, though (for somewhat obvious reasons). You can download a free local copy and purchase a more advanced version with more information. But if you need a simple lookup, the database is free, excellent, and is updated twice a week.
https://dev.maxmind.com/geoip/geolite2-free-geolocation-data