Coffee is healthier than soda if you take your coffee black. Black coffee is basically just water. Soda will have either sugar or artificial sweeteners in additional to sodium and other additives that make it a less healthy option.
Coffee with milk would still be better for you than soda, but you’ve got a good point about coffee with sweeteners essentially being just as bad as soda. Maybe the reason people treat coffee differently is because there is a healthy way to drink it and they incorrectly extrapolate that fact to any type of coffee (no, your coffee with eight sugars is not healthier than a can of Coke). Add in the fact that coffee is an acquired taste and now you’ve got one drink that only adults tend to drink (coffee) and one drink that kids love (soda) and people incorrectly assume that coffee is a more “grown up” thing to drink.
I think you know why