Posner is against the idea:

A tax on calories, or on high-calorie foods or ingredients, would be difficult to design and administer and would impose welfare losses, without significant offsetting wealth gains, on thin people. A further problem is that fattening foods, including sugar-flavored sodas, have fallen in price over time relative to fruits and vegetables and other healthful foods, so that a tax on calories would be highly regressive.

Gary Becker adds more arguments against the tax. Derek Thompson argues in favor of sin taxes:

At best, sin taxes take stock of the negative health externalities of obviously toxic products. If Virginia raises its (currently very low) tobacco tax and earmarks the funds for health care, it's either doing one of two things: Discouraging cigaratte use or raising money to cure future emphysema cases. Whether the tax forces VA consumers to question their smoking or pay for its effect, it's still preferable to having the rest of the state pay more taxes for their failing health. At the end of the day, we might as well tax the things we're only going to have to pay for later.