I believe it used a different plastic? Except the spacebar... the space bar does yellow.
Correct, the keycaps use PBT rather than ABS. I don't know if PBT is entirely immune to yellowing, but it sure is far more resistant to it (but that makes sense, given yellowing plastics are known to be caused by oxidizing of the polymers in ABS specifically).
The spacebar was made out of ABS. This isn't uncommon for keyboards, and there are other vintage keyboards outside of Apple's where the casing and spacebar will yellow, but the caps won't. From what I understand, it was both too costly and too complicated to make the spacebar out of PBT, as certain properties of PBT make it more susceptible to shrinkage during the molding process. This could cause spacebars to come out warped and deformed, so they just went with ABS for those.
There do exist keyboards and keycap sets with PBT spacebars, but I have heard that it's not extremely uncommon for the keycap sets to come with warped SBs, if they slipped past QC. Presumably the price of mitigating molding issues and proper QC to make sure no funky SBs got through, didn't weigh up against just using ABS instead.