Afaik, it depends on the engine. Each one does differently.
There are hardly any major game engines left who don't offer free versions. But commercial ones make money either through: 1. Having some features(aka Pro or Enterprise version) or export options paid. 2. Royalties from the games made(a cut in your profits). 3. Ads. 4. Contracts with bigger companies, government, orgs, etc. 5. Projects with movie industry and other fields(research, simulation, labs, universities). 6. There might be more ways.
Free and Open-Source game engines mostly monetize from sponsors, donations and contributions or just don't earn.