Obviously this is a question that could have very different answers depending on the specific country.
For your specific example of Australia, the official list of actions that can be taken for refused items are :
- pay for the item to be treated to make it safe (for example fumigation, irradiation)
- store the item at the airport for collection when you leave Australia
- re–export the item or
- have the item destroyed by AQIS.
So thus, no, eating the item is not an option – at least, not officially…
Unless there’s something very special about them, importing chocolates into Australia is not a problem – just remember that you DO still need to declare them under the “Food” question.