It can be either, depending on your definition. Here's the rest of the story.
In 1883, a tariff was imposed on imported vegetables, but not on imported fruits. John Nix, a tomato importer at the time, sued Edward L. Hedden, Collector of the Port of New York, on the ground that tomato was a fruit and should not have been taxed.
The case of Nix v. Hedden went all the way to the US Supreme Court in 1893. The court heard all the arguments presented by experts, and read from dictionaries for the definition of vegetable and fruit.
In the end, a unanimous decree was reached by the court. I paraphrase as follows:
"Botanically the tomato is a fruit, but it is served and eaten as a vegetable and not as a fruit. What is eaten as a vegetable has to be taxed as a vegetable."
And so, the tomato can be either a fruit or a vegetable, depending on whether your definition is a botanical or a fiscal one.