由 is used to emphasize the people who should be responsible for something and purposiveness is very strong.
被 is used to emphasize to what results some actions done by somebody lead and purposiveness is not strong.
Sentence a&b mainly indicate it’s “ 我” that is responsible for buying the fruits instead any other people. The person who should do this job is arranged on purpose so the purposiveness is very strong.
Sentence c mainly tells the glasses was broken and sentence d tells the bicycle was stolen. The result is broken and stolen. As for who broke the glasses and who stole the bicycle is not important.