You guys are quick but incorrect. The song is correct.... they are a fruit!
Wiko; "Beans, Beans, the Musical Fruit" is a children's song about the flatulence often experienced after eating beans. The song is noteworthy for correctly identifying the bean as a fruit, not a vegetable.