The big cost here is likely to be labor. When you give away free sodas you have to pay someone to keep sodas in stock. When you sell sodas you can even sell a contract to a 3rd party to restock the machines. This is why free sodas are fairly rare, because soda machines are a money maker for the company and involve fewer employees on the balance sheet, whereas free sodas rack up all of the costs of an employee (salary, taxes, benefits, etc.)
On the whole it's probably a silly tradeoff, since the benefits to employee retention of free sodas almost certainly far outweigh the comparatively minor costs, but if you just look at the balance sheet it can be awfully tempting to get rid of.