Spammers have to send messages from a number, which aren’t infinite supply.
The numbers are spoofed. They really do have a near infinite supply. If one has their own SS7 link they can spoof any number. There are plenty of shady VoIP services that enable this.