As pharmacy chains await Amazon.com Inc.’s entry into the prescription-drug market, the online retail giant is already undercutting them for nonprescription medicine for aches, colds and allergies.

Median prices for over-the-counter, private-brand medicine sold by Walgreens Boots Alliance Inc. and CVS Health Corp. were about 20% higher than Basic Care, the over-the-counter drug line sold exclusively by Amazon, according to a report Friday by Jefferies Group analysts.