Shares of Anthem (ANTM - Get Report)  were falling in trading Wednesday as the healthcare provider's second-quarter revenue and earnings beats were overshadowed by higher costs. 

The company reported earnings of $4.64 per share on revenue of $25.18 billion, well ahead of Wall Street expectations for earnings of $4.61 per share on revenue of $23 billion.

However, the company also reported 10.2% decrease in operating profit from the unit that sells Medicaid due to what it said was elevated medical cost trends in Medicaid in some states. 

The company's benefit expense ratio, or the percentage of premiums paid for medical services, worsened to 86.7% from 83.4% last year. Analysts were expecting a ratio of 86%, according to Refinitiv. 

"Our second-quarter results reflect solid top-line growth across our businesses and reinforce our commitment to innovation and performance execution," said CEO Gail K. Boudreaux.

The stock was down 4.61% to $288 in trading.