I am under the impression that a custom SObject can have no more than 500 (or 800) fields in total across all namespaces. From the Salesforce Features and Edition Allocations documentation there is this table entry:
ENTERPRISE EDITION UNLIMITED AND PERFORMANCE EDITION Custom fields per object 500 800
and this footnote:
An org can’t have more than 800 custom fields, regardless of the edition or source of those fields. For example, an Enterprise Edition org can have 500 custom fields per object, and 300 more fields installed from a managed package for a total limit of 800 fields per object.
But when you add say 3 fields in the Classic UI Setup to an installed managed package custom object in a "Developer Edition" scratch org, the "Limits" UI says:
Usage Limit 3 500
rather than subtracting the number of fields on that object already in the managed package.
Is this "Limits" UI presenting the truth here? Where does the 300 in "300 more fields installed from a managed package" come from in this? Is there a clearer explanation of this somewhere in the Salesforce docs? Or if you are clear on the rules, post your own explanation as an answer.
Sanket has flagged this existing question and answer Custom Field Limits For Managed Packages. That does suggest that the
Value500 idea described in this old The Force.com Multitenant Architecture document is a thing of the past and that perhaps the limit today is 500 fields per namespace. Or a 500 field row per namespace so that one SObject record is sometimes represented by multiple 500 field rows?
The last comment in the existing question and answer (from 2016) includes:
Still seeing inconsistent behaviour across environments though