Genetic diversity of seven cultivated populations of Codonopsis pilosula Nannf. from Longxi County, Gansu Province of China was estimated using randomly amplified polymorphic DNA (RAPD) markers. The 17 selected RAPD primers amplified 205 polymorphic bands out of a total of 235 (87.2%). Nei's gene-diversity statistics and population differentiation parameters based on AMOVA analysis indicated that the cultivated C. pilosula populations remained a high level of genetic diversity with Hs = 0.299 and I = 0.450. A greater proportion of genetic diversity was found within (77%) rather than among (23%) the populations. In addition, we also detected that populations from different altitudes had a considerable genetic differentiation after 40 years of cultivation at the same site. Populations from higher altitude had lower genetic diversity than those from lower altitude. Our results suggested that irregular and sparse cultivation practices, i.e., random collecting, preserving, and planting seeds of the medicinal species without deliberate selection, might be an efficient way to conserve genetic resources of medicinal plants, in addition to their effective uses.