In the latest challenge for the battered music industry, pirates are flooding Amazon.com Inc. and other online retailers with counterfeit CDs that often cost nearly as much as the official versions and increasingly are difficult to distinguish from the real goods.