In-app purchases allow developers to offer the app for free in the App Store (for iOS) and Google Play (for Android). Then, within the application, they can upsell and advertise paid upgrades, locked features, special items, and other premium offers.
In the App Store, if an app has a Get button instead of a price, the app is free. You won't be charged for downloading a free app.