A sweetened beverage tax sign is posted by sweetened beverages at a supermarket in the Port Richmond neighborhood of Philadelphia, Wednesday, July 18, 2018.

Sugary drink sales dropped 38% in Philadelphia after the city started taxing soda and other sweet beverages in 2017, according to a study published Tuesday in the Journal of the American Medical Association.

Philadelphia levied a tax of 1.5 cents per ounce on sweetened drinks beginning Jan. 1, 2017, following Berkeley, California, as the second city in the country to implement the levy.

Supporters argue soda taxes can discourage people from indulging in sugary drinks, possibly helping curb obesity, diabetes and other diet-related conditions. Critics say governments should not dictate what people drink, and raising the price in one city will simply cause people to shop elsewhere. Beverage sales inside Philadelphia's city limits dropped by 51% but were partially offset by an increase in sales just outside the city, resulting in a net decrease in soda sales of 38% in the area, researchers at the University of Pennsylvania found.

For more on investing in health-care innovation, click here to join CNBC at our Healthy Returns Summit in New York City on May 21.

To measure how Philadelphia's tax affected sales of sugary drinks, researchers analyzed scanner data from market research firm IRI during the year before the tax took effect and the year after. They analyzed sales in Philadelphia, neighboring communities and Baltimore, which served as a control group. They did not study people's actual consumption habits or health outcomes.