The first time I grew peanuts I thought the 'nuts' grew underground like a potato. But no, not exactly; after the flower falls away the flower stalk elongates, searches for the ground and grows into the soil...and then makes the 'nuts'.
These are some smart plants!