This mentality is called reductionism, but it's not just the presence of sugars that matters, it's also what kind of sugar and in combination with what else. Sodas like Coke or Pepsi contain other things as well, besides the high fructose corn syrup which is the worst sugar you can find, or the phosphoric acid, things like Bisphenol-A, Sodium Cyclamate and 4-MEI.
Ice cream can be mostly made of natural ingredients, like milk, in which case it would get its sweetness from the lactose in that milk. Ice-cream can also be made of fruits, like peaches, or coconuts. The ingredients can be all organic and ice-cream can be made at home. Furthermore, after one cup of ice cream, most people are done, whereas Coke drinkers can drink more than half a gallon per day, because it is engineered to create addiction.
Of course, ice-cream can be made from processed ingredients as well and with plenty of HFCS or other cancerogenic and diabet-inducing ingredients. But reduce the problem to one ingredient or another and you end up missing the forest from the trees.