By Elaine S. Povich

Hot air balloon rides are the stuff of whimsy _ think Kansas and the "Wizard of Oz." But whether you pay Kansas sales taxes on that beautiful balloon ride depends on whether you take off to lands over the rainbow or stay tethered to the ground.

A ride on a tethered balloon is subject to Kansas' 6.5 percent sales tax (along with any local taxes) because the ride is labeled an amusement. A ride on an untethered hot air balloon, however, is categorized as transportation, and is not taxed.

In New York, home to unrivaled bagels, if you buy a whole roll with a hole at a bagel shop or supermarket, you don't pay tax. If, however, you buy that bagel sliced, with lox and cream cheese (New York style), it's subject to a 4 percent state sales tax, along with local taxes. That can add up to a levy of nearly 9 percent in some jurisdictions.

It's anomalies in the tax code like these that flummox consumers and retailers and drive state tax departments to issue complicated rulings _ all in the name of clarifying things that on the surface seem incongruous. But when you dig deeper, you find that they make (at least some) sense.

In Kansas, the state Department of Revenue ruled, in response to a taxpayer inquiry, that a federal law, the Anti-Head Tax Act, barred Kansas from imposing a sales tax on hot air balloon rides "where the hot air balloon is piloted and untethered and 'travels' by air for some distance downwind from the launching point, the hot air balloon operator thereby carrying passengers in air commerce."

In New York, those nicely dressed bagels are taxable because they are sold ready to eat, especially if they are toasted. According to Geoffrey Gloak, spokesman for the state Department of Taxation and Finance, the general rules go like this:

_If it's heated, it's taxable.

_If it's a sandwich, it's taxable.

_If it's served ready to eat on the premises, it's taxable.

_If it's sold for off-premises consumption (to go) the same way a supermarket would sell it _ cold and in a bag _ it's not taxable. "So, when it comes to bagels, if a bagel is sold toasted, buttered or with cream cheese, it's taxable," Gloak said. "Whether it's sliced or not is not the issue."

In addition to bagels, other kinds of food, and alcohol, generate some of the most seemingly inconsistent tax rules in the states.

You'd think Maine officials would want to promote the official state fruit, the wild blueberry. Well, they do, but it costs extra for that promotion. Here's how it works: An extra tax of 1.5 cents per pound is levied on all wild (also known as low bush) blueberries before they are processed in Maine or shipped out of state. The tax does not apply to cultivated blueberries. The state Department of Administrative and Financial Services says that the low bush tax generated $1.8 million in fiscal 2015, all of which was used to promote wild blueberry sales or to fund research and educational programs about the yummy fruit.

Back to Kansas for another hard-to-fathom tax disparity, this one on beer, and what is affectionately called near beer, the low-alcohol version of the drink. The conventional wisdom is that the more alcohol a drink contains, the more tax is levied on it. But not in Kansas.

Kansas law allows the weak beer, also known as 3.2 beer for its alcohol content, to be sold in grocery or convenience stores. There, it is subject to a 6.5 percent state sales tax, plus local taxes, bringing the combined tax to 8.4 percent on average. But regular beer, which has a higher alcohol content and is sold in liquor stores, is not subject to sales tax. Instead, a liquor enforcement tax of 8 percent is levied, which is less than the average tax on the near beer stuff.

Jeannine Koranda, spokeswoman for the Kansas Department of Revenue, shrugged off the incongruity. "There are many strange quirks in the tax system," she said.

Then there's Illinois, where candy is subject to a tax of 6.25 percent _ except when it's not. To explain: The Streamlined Sales and Use Tax Agreement, which attempts to set standards nationwide for sales taxes, differentiates between candy and cookies or cakes, which have always been considered "food." The difference comes down to whether the product contains flour. That's easy to understand, except when it comes to things like Kit-Kat bars, sold in the candy aisle but containing flour. The result: When Illinois raised its candy tax to 6.25 percent in 2009, it didn't encompass those Kit-Kats.

Candy was "peeled out of the definition of 'food for human consumption to be consumed off the premises where sold' (i.e., grocery food)," said Terry Horstman, spokesman for the state Department of Revenue. The tax on candy went from 1 to 6.25 percent.

In California, it pays to buy an apple in the grocery store, not in a vending machine. Here's why: that apple in a grocery store is not taxed. But wrap it up or slice it and put it in a package to be sold in a vending machine, and a tax of 33 percent is applied.

The tax originated in an attempt to make things easier for vending machine operators, according to H.D. Palmer, spokesman for the state Department of Finance. Since vending machines exist in places where food sales are taxed (such as amusement parks) and also in places where food is not taxed (such as grocery stores and shopping malls), it was hard for the vending machine owners to figure out where they should charge sales taxes for their products and where they should not. The compromise was to tax all vending machine sales at 33 percent, a reasonable proxy for the percentage of vending machine sales in taxable locations divided by the total vending machine sales, he said.