There are at least four definitions relating to fruits and vegetables:
Fruit (botany): the ovary of a flowering plant (sometimes including accessory structures),
Fruit (culinary): any edible part of a plant with a sweet flavor,
Vegetable: any edible part of a plant with a savory flavor.
Vegetable (legal): commodities that are taxed as vegetables in a particular jurisdiction
...
The question of whether the tomato is a fruit or a vegetable found its way into the United States Supreme Court in 1893. The court ruled unanimously in Nix v. Hedden that a tomato is correctly identified as, and thus taxed as, a vegetable, for the purposes of the Tariff of 1883 on imported produce. The court did acknowledge, however, that, botanically speaking, a tomato is a fruit.