This is financially illiterate because you're mixing revenue ("membership fees") with profit ("net operating income"). While it might be tempting to assume that membership fees is pure profit for them, it's not, because people only buy memberships because they're useful for something (ie. shopping at their stores). Therefore you can't strip that out from the other costs associated with operating a chain of warehouses.
I much prefer this to stores that are happy to burn customers, never expecting to see them again.
You think dollar general is making $37.9B (in 2023) of annual revenue from one-off customers? Unless you're operating a tourist trap, or some sort of business that people only need a few times in their lifetimes (eg. real estate agents), most businesses rely on repeat customers.
I have money to buy in bulk, care about quality, and am willing to make longer trips to stock up. The membership is trivial relative to annual groceries.
I think think the target market for dollar stores is the opposite
So yes, Costco does make most of its profit by ensuring customers are happy and continue to renew their memberships every year.