In the case of Nix v. Hedden, the U.S. Supreme Court ruled that tomatoes are vegetables, despite the botanical fact that tomatoes are fruits. According to the Concise Oxford Dictionary of Botany, a fruit is defined as "strictly, the ripened ovary of a plant and its contents. More loosely, the term is extended to the ripened ovary and seeds together with any structure with which they are combined."
To illustrate this definition, let's focus on a fruit more commonly recognized as such: the apple. Botanists consider an apple core a fruit, because it is a ripened ovary containing seeds. But by the looser definition of fruit, an entire apple (the core and the flesh surrounding the core) is also considered a fruit. Common garden "vegetables" that are actually fruit, include cucumbers, squash, peppers, and yes, tomatoes. Vegetables encompass all other edible parts of a plant that aren't fruit, including roots, tubers, stems, and leaves. Potatoes, carrots, greens, fennel bulbs, and onions are examples of real vegetables.