There are two sides to the discussion about losing weight by cycling:
(1) The first concerns people who want to lose weight and take up cycling as a way of achieving that goal, and
(2) The second concerns regular cyclists, who find they are losing weight whether they want to or not!
Looking at the first of these, it is almost impossible to cycle regularly and with a reasonable amount of effort and NOT lose weight! Cycling typically uses 750 calories per hour, so if you cycle for two hours and have a snack when you get home (say 150 calories if you can be reasonably sensible) then you will lose weight.
For rides over about two hours long will probably need to eat something during your ride as well, typically an energy bar, but the energy used by the extra exercise will still much more than compensate.
This is a very efficient way to lose weight. There are very few sports where you can sustain an effort for two- four hours..
Note - if you cycle slowly for half an hour then have a big slice of cake to congratulate yourself this doesn't work!
Unfortunately if you are overweight and haven't cycled for quite some time the first few outings on your bike will be hard and probably quite short, and won't use a great number of calories. But after a few trips to get your legs into some sort of cycling condition, you will find that things get much easier - and the weight starts to come off. I'm not sure of an easy way to avoid this initial 'lots of pain, not much gain' period, but don't worry it passes very quickly.
As a rough guide, I cycle perhaps an average of 6 - 8 hours per week, sometimes a bit more, and lose about 5 kilogrammes a month when I start cycling 'properly' after a winter of sloth and over-indulgence. The level of weight loss will be different for everyone of course but I never heard of a regular cyclist putting on weight.
Indeed for regular cyclists the problem is the opposite. As mentioned above - if you cycle a lot you can't stop yourself losing weight, and the problem is then one of maintaining your weight.
Happily this is not a concern for so many people - most of us will naturally eat more if we are doing lots of hard exercise. The key is to eat well but eat sensibly. No problem with pasta, bananas, cereals, a sandwich - the trick is to avoid eating excessive amounts of snack type food as soon as you return from a bike ride, but to eat more at regular mealtimes.
Exercise bikes and bikes in gyms will often tell you the level of calories you have used in a given time. This is a useful guide, but I think that cycling on real roads, with real hills and wind, and extra motivation, will pretty much always use more energy for the same time in the saddle. I use an exercise bike at home during the winter and still manage to put on weight...
Overall, weight loss through cycling is not just easy it is also inevitable. And it's also great fun, so make a start today!