Mylan Inc. (MYL) swung to a third-quarter loss due to its $121 million settlement of a Medicaid-rebate case, masking higher generic drug revenue.

But core results beat Wall Street estimates, prompting Mylan to again boost its full-year earnings target, this time to a range of $1.24 to $1.28 a share from $1.13 to $1.20.

Generic-drug use has risen as insurers, among others, increasingly push for their purchase over higher-priced brand names. But quality-control issues and shortages at several smaller generic drug makers have allowed larger players like Mylan to grab market share and boost prices, observers say.

Meantime, Standard & Poor's Ratings Services in September raised Mylan's ratings closer to investment grade, citing the company's successful integration of Merck KGaA's (MRK.XE) generics business, which Mylan purchased for $6.7 billion in 2007.

Mylan swung to a loss of $40 million, or 13 cents a share, from year-earlier profit of $182.4 million, or 47 cents a share. Excluding items such as the settlement related to allegation it underpaid rebates to Medicaid for several of the company's drugs, earnings rose to 32 cents a share from 23 cents.

Revenue skidded 24% to $1.26 billion as the prior year included $455 million from selling rights to hypertension drug Bystolic, which Mylan co-developed with Forest Laboratories Inc. (FRX). Excluding foreign-exchange impacts, revenue excluding the gain rose 9%.

Analysts surveyed by Thomson Reuters were expecting earnings, excluding items, of 27 cents on revenue of $1.23 billion.

Excluding Bystolic and the charges, gross margin fell to 45.6% from 46.7%.

Generics revenue rose 3.7%, with North America seeing a 9.2% increase.

Mylan shares closed at $15.77 and didn't trade premarket. The stock has more than doubled the past year.

-By Mike Barris, Dow Jones Newswires; 212-416-2330; mike.barris@dowjones.com