Agreed it's a weird comparison, but I'd argue SG&A needs to come out of gross margin too for a fair comparison. You need a warehouse/staff/utilities/etc to sell merchandise, you need nothing to sell a membership (whether it's worth anything is another question of course).
In their 2025 filing, gross margin on merchandise was $30B, but SG&A cost $25B (with membership fees at $5.3B).
Note that $2.6B of those membership fees will go back to members as membership rewards, which is interesting too.