Hyoscyamine and scopolamine (HS), two valuable tropane alkaloids of significant medicinal importance, are found in multiple distantly related lineages within the Solanaceae family. Here we sequence the genomes of three representative species that produce HS from these lineages, and one species that does not produce HS. Our analysis reveals a shared biosynthetic pathway responsible for HS production in the three HS-producing species. We observe a high level of gene collinearity related to HS synthesis across the family in both types of species. By introducing gain-of-function and loss-of-function mutations at key sites, we confirm the reduced/lost or re-activated functions of critical genes involved in HS synthesis in both types of species, respectively. These findings indicate independent and repeated losses of the HS biosynthesis pathway since its origin in the ancestral lineage. Our results hold promise for potential future applications in the artificial engineering of HS biosynthesis in Solanaceae crops.