Just one of the genetically engineered tomatoes grown by British scientists contains as much of the grape compound resveratrol as 50 bottles of red wine.
The antioxidant chemical is said to combat heart disease, cancer, diabetes and Alzheimer's disease, although these claims are controversial.
Another tomato produced the same amount of genistein - a soybean compound that may help prevent breast cancer - as 2.5 kilograms (five pounds) of tofu.
Professor Cathie Martin, from, the John Innes Centre in Norwich, said: "Our study provides a general tool for producing valuable phenylpropanoid compounds on an industrial scale in plants, and potentially production of other products derived from aromatic amino acids.
"Our work will be of interest to different research areas including fundamental research on plants, plant/microbe engineering, medicinal plant natural products, as well as diet and health research."
The key to turning tomatoes into natural medicine factories is a protein called AtMYB12, found in the garden weed thale cress.
Introducing the protein to tomatoes acted like opening a tap to boost levels of phenylpropanoids, a family of organic compounds that give rise to a wide range of plant chemicals.
Genes encoding specific enzymes were added to switch on production resveratrol or genistein, the researchers reported in the journal Nature Communications.
They believe the same technique could be used to manufacture other compounds that form the basis of many medicines.
Tomatoes are a high-yield crop, with up to 500 tonnes of the fruit per hectare being harvested in some countries, and cheap to grow.
The scientists hope they will provide a more cost-effective way of producing valuable plant compounds than synthesising them artificially or extracting tiny amounts from natural sources such as grapes and soybeans.
Co-author Dr Yang Zhang, also from the John Innes Centre, said: "Medicinal plants with high value are often difficult to grow and manage, and need very long cultivation times to produce the desired compounds.
"Our research provides a fantastic platform to quickly produce these valuable medicinal compounds in tomatoes. Target compounds could be purified directly from tomato juice.
"We believe our design idea could also be applied to other compounds such as terpenoids and alkaloids, which are the major groups of medicinal compounds from plants."