I think the answer really is that the steadily increasing cost of raw materials for soda (which remained stable in real terms for most of those 70 years) was countered by other efficiencies.
For example, in 1886, 1,000 cases of coke were delivered by a bunch of coachman with a horse-driven wagon serving customers in a limited area. In 1936, 1,000 cases of coke were delivered by a much smaller number of truck drivers serving more customers in a wider area.
8 oz bottles of coke were also re-used. So the machinery used to wash those bottled became more efficient throughout those 70 years.
Another key factor is alternate delivery mechanisms. At some point, soda fountains became a common and higher margin channel for selling Coke. The margins on bottles were tighter, but the bottles probably helped drive sales at the fountain.
Remember that Coke the trademark owner is distinct from Coke the bottler/distributor. The Coke bottler owned the relationships with stores and restaurants, and probably had the ability to sell complimentary products (pretzels, etc) when they were dropping off the Coke order.