The answer to this question is going to have to be found through personal search.
How badly do you need this job?
Do you have family to take care off? Debt to pay off? High bills? No savings?
If you can afford to do so, then speak up
In the case of beingIf you're in a stable financial position (not related to the $5 you are being asked to pay, but taking into account possible consequences ofin case speaking up doesn't go well) where if necessary a job change wouldn't affect you (be it due to dismissal,i.e. fired or simply because after the confrontation the work environment has changed to a point where you no longer feel as comfortable working therepressured to resign), you should at least query why you are being asked to pay for this, as you can't recall any communication regarding payment before the party happened.
If you didn't know it was happening, It's possible you might have missed communications regarding this prior to the party.
In If this isn't the case it was never communicated then politely decline to contribute as you had not been informed prior to the event that there would be a fee to pay.
You can look into the whistle-blowing policy in your company as well,well; being required to pay for something like this could actually be illegal in your country/state (it is in the UK).
Otherwise say nothing and pay the $5
If you need the job and if job hunting, interviewing and changing jobs is not an option (or possibility), then "swallow the frog" and pay up.
As As unsavory as it is, sometimes we have to do things we don't like for the money we need to pay for things we do like.