There’s different internal network configs (APNs), and hotspot uses a different one than regular mobile data. ( or at least it used to). Those can be configured and metered separately from the carrier’s end.
LineageOS, and maybe some other custom ROMs, wouldn’t do that and would put the hotspot and mobile data on the same APN to get around that.