The profit might come from the soda and the fries sold alongside the burger, but if people aren't coming for the burger or the nuggets or whatever they're probably not coming for that soda either. They'll be at the restaurant next door buying the soda there.
I imagine few (though I agree definitely not zero) consumers go to McDonalds purely for sodas.