From the Super Mario Wiki
A Garlic Dispenser is a support object in Wario World. It sells Wario garlic, which heals him. A Garlic Dispenser looks like a red vending machine with a face and a giant head of garlic on top. When approaching one, it will make alluring gestures, trying to convince Wario to spend his money. The first Garlic Dispenser that Wario encounters in Greenhorn Forest also speaks to him, explaining that Wario must "take it on" in order to buy garlic.
When Wario punches one, he'll receive a head of garlic in exchange for some of his coins. The cost of garlic increases in later levels. There is no limit to how much garlic Wario can buy, as long as he has enough coins. Some Garlic Dispensers will increase the price by either 5 or 10 coins (depending on the level) for each subsequent head of garlic he buys.