Yes, an exercise bike is one of the best exercises for weight loss. If you do it for a long time like you mentioned, you won't gain much muscle but you will burn a lot of fat.
I haven't been overweight, but I have used an exercise bike to trim up, and I still ride it about 3 times per week.
For weight loss, an exercise bike is superior to running because if you are overweight, jogging will probably do long term damage to your knees where biking is quite gentle.