The only comparison between guns and cakes is that a customer can generally go to another store. Iinm, gun store owners are not legally required to sell guns to any individual. It's not really different from a bartender. The legal question may come down to whether an age requirement is discrimination. If so, then why shouldn't 17 year-olds be allowed? And even if it's a law, it can be deemed discriminatory.
Discrimination is necessary. The issue is what it's based on. Age-discrimination is not the same as sex, sexual orientation, racial, or ethnic discrimination. Everybody has an age, though. So, imo, it's the fairest form of discrimination.
Oh, not to mention the many laws against gun possession in US history. So, I can't be outraged at this.