Can it be both? The tomato isn't the problem, it's the terms "fruits" and "vegetables". When the tomato is classified as a fruit, we're considering it as "fruit" in the botanical sense. All botanists agree that the tomato is the fruit of the tomato plant. That's great if you want to grow them in the garden, but terrible once you take them into the kitchen.
|The poor old tomato looks pretty lonely in this diagram.|
When cooking, classifying plants by their botanical function is fairly pointless. However, if you classify them according to their culinary function, you'll end up with better meals. This is how the tomato gets classified as a vegetable, along with a number of other botanical fruits that don't taste very good with their fellow fruits.
Additionally, in the US, the tomato is legally classified as a vegetable. In the late 19th century, an importer in New York argued that he was exempt from paying import duty on "foreign vegetables" because his tomatoes were fruits. While "botanically" correct, the Supreme Court didn't favour his smart-arsery and declared the fruit a vegetable for legal purposes.
So, is a tomato a fruit or a vegetable? If you're a botanist, it's a fruit. If you're a chef, it's a vegetable. And if you're a lawyer, it's also a vegetable. Don't even get us started on cucumbers!