Sugar isn't "objectively bad" in moderation. Gambling might be bad if you only look at the expected (monetary) value, but if you factor entertainment value it might be okay.
Can't the same be said of heroin, which in the UK is prescribed as a medication under the name diamorphine? Both of these substances can be safe in limited quantities, and both of them exploit vulnerabilities in human physiology or psychology that results in over-consumption being a very common outcome. One of them is strictly regulated when not banned outright, but the other is freely given to any kid who has spare pocket change, no questions asked.