Sure, depending on how the machine is constructed or programmed.
A function can represent any process that takes some input and assigns exactly one output to it. In the case of a simple vending machine, there could one button or sequence of button presses that correspond to the delivery of a certain drink or snack (provided that enough money is fed into the machine first).
A machine that wouldn't qualify as representing a function would be one that consistently offers two or more different drinks.