As far as i know yep its all about the money. The companies ie Stella Artois, Cadburys etc pay a certain amount to the channel/production company and in return they get to have their name splashed alongside certain programmes. Cadburys mustve paid a fortune to get the Corrie sponsorship as to just have one normal ad in the Corrie half time commercial break is the most expensive on tv.
Its a great way for companies to advertise. Although you probably dont realise it, it raises your awareness of the product/brand. You see the logo all the time and are sub consciously made to think about the company. A good example if this is the barclays premier league. Without knowing it you are always thinking about the company name. So basically it is just to raise people's awareness of brands, companies...etc