Supposedly it comes from apples being an abundant source of food/water during periods when teachers weren’t paid in money. Also it can be made into alcohol easily. Potatoes were also popular for the same reasons but that didn’t stick as well.
So modern equivalent is probably chocolates with booze in them.