While true as long as they're in compliance with the law, wouldn't they want to sell all the Sudafed they can? They can deny service to anyone for pretty much any reason. No shirt, no shoes, no Sudafed or anything else. So yeah, but in reality it isn't aligned with their interests and if they don't want to serve you they can always find a different justification.
Maybe they want that, maybe they don't. Retail drug stores in the US are an oligopoly, that industry may not be a monopoly (yet) but they don't function under perfect competition. Maybe if you're the management or the shareholders of a retail drug chain you're just kind of shrugging your shoulders and working on the next merger at this point since the fewer competitors you have, the less hard you have to work for the customer's dollar.