A Jew and a non-Jew were traveling together and stopped off somewhere along the highway to eat lunch.
“Do you want some wine?” the non-Jew asked.
“No thanks. Jews aren't permitted to drink that wine.”
“How about a sausage? I have extra.”
“No, thank you. We can't eat that either.”
“It is delicious. You’re sure you can't eat it?”
“I'm positive. We are only allowed to eat such foods when one's life is in danger.”
“What do you mean?”
"Well, let's say someone is ill, and a doctor says he needs to eat these foods to live."
"Then you would be allowed to eat it?"
"Definitely. Or let's say a non-Jew takes out a knife and says, ‘If you don't eat this food, I will kill you,’ then we would also be allowed to eat it."
The non-Jew took out his knife, pointed it at the Jew and said, "Eat my food, or I'll kill you.”
The Jew was afraid and began eating. What could he do? It was pikuach nefesh [life threatening].
"I'm sorry I did that to you," the non-Jew said a few minutes later. “I was just joking.”
The Jew put down the meat and pushed the wine to the side and said, “I forgive you for playing that prank on me, but I won’t forgive you for telling me now that it was a joke. Why didn't you wait until I finished the meal?”
With this story, we can explain the aveirah that the Jewish nation committed by eating at Achashveirosh's feast. The sin was that they wanted to be there. They were permitted to eat at this meal because their lives would be at stake if they didn't, but they should have gone with a heavy heart.
Chazal say that they were punished, שנהנו מסעודתו של אחשורש, because they enjoyed Achashveirosh's meal. The problem was that they looked forward to it and were happy to be there.
The Chasam Sofer (Toras Moshe, Esther, d.h Isa B’Megillah) says, that they should have eaten at home before going to the party, so the non-kosher food at the party would be achilah gasah (eating after they were full when one doesn't enjoy eating, which isn't called eating, according to halachah). Then it would be as though they didn’t eat non-kosher foods. (R’ Elimelech Biderman)