I just checked in a Scratch org I created yesterday. It is a standard Developer Edition org.
You are currently using 1,797,594 characters of Apex Code (excluding comments and @isTest annotated classes) in your organization, out of an allowed limit of 10,000,000 characters. Note that the amount in use includes both Apex Classes and Triggers defined in your organization.
Seems that they default to a higher character limit.
More official answer from Salesforce DX Trailblazer community group.
A DE scratch org indeed has a default limit of 10M characters of apex code. We increased the number to accommodate requests for a higher limit and due to the inability to configure this in the scratch definition. We will evaluate if the default should be decreased with an added scratch def feature. [We] are also working on ways to better document the default limits.
Guess it would take too long to wait for Salesforce support to bump up the Apex limit on each new scratch org, so easier to just start with the higher limit.