Hains, a teacher, said the cupcake was a gift from one of her students. She was traveling with her husband and toddler, and thought her young son might get hungry on the long trip home.

The cupcake was packaged in a glass container with a metal lid, which was why it attracted the attention of the scanner in the first place.

The TSA agent didn't know what to do with the cupcake, so she called over her supervisor, Hains said.

"The TSA supervisor, Robert Epps, was using really bad logic - he said it counted as a gel-like substance because it was conforming to the shape of its container."

"We also had a small pile of hummus sandwiches with creamy fillings, which made it through, but the cupcake with its frosting was apparently a terrorist threat...I just don't know what world he was living in," said Hains, speaking of the TSA officer.

Hains said she had flown from Boston to Las Vegas with two cupcakes without any problems.

"The TSA at Logan Airport said the cupcakes looked delicious and told us to have a great trip. But in Las Vegas, they were dangerous. They shouldn't be delicious in one part of the country and a security threat in the other."

Hains called the TSA "security theater."

"You'd expect them to be consistent. If they're doing what they claim to be doing and actually protecting travelers, they would be applying their rules using critical thinking. He gave no indication that really thought the cupcake was a threat."

"This really isn't about the cupcake, it's about the bigger issue and it's indicative of the fact that broader reforms need to be made to the TSA because they are not keeping us safe," said Hains.

"In general, cakes and pies are allowed in carry-on luggage," TSA spokesperson James Fotenos told ABC News affiliate WCVB. Fotenos added that they were looking into why this cupcake was confiscated.