Due to the extremely low cost of fountain soft drinks (especially the beverage itself, not including the cost of the cup, lid and straw), often offering a profit margin of 80-82%, establishments tend to offer free refills as a sales gimmick.
When I worked at Pizza Hut (early 2000s), for shits and giggles I calculated the actual cost of a glass of Pepsi. Accounting for the syrup bag, the CO2 cylinder and water (the latter being the cheapest since it was filtered tap from the city main) it was like $0.14 a glass.