While prolonged drought has strained California agriculture, most of the state's farms, it seems, aren't just surviving it: They are prospering.

The environment, though, that's another story. We'll get to that.

But first, the prosperity. According to new figures from the U.S. Department of Agriculture, in 2014, the year the drought really hit, California's farmers sold $54 billion worth of crops like almonds or grapes, and animal products like milk.

That's an all-time record, up 5 percent over the previous year, and an increase of 20 percent from 2012.

If you're surprised by this, you haven't been paying close attention, says Daniel Sumner, an agricultural economist at the University of California, Davis. It's been clear for some time, he says, that California's farmers did very well last year.

There are two keys to the record-breaking revenues. The first is prices. "You have all-time high prices over the whole range of crops," says Richard Howitt, another economist at UC Davis.

Second, even though farmers didn't get their normal supply of water from rivers and reservoirs, they pumped it from underground aquifers instead. According to a report that Sumner and Howitt co-authored last year, farmers in 2014 replaced about 75 percent of their surface water deficit by draining their groundwater reserves.

James McFarlane, who grows almonds and citrus near Fresno, is one of those farmers. He says that drought has been "beyond terrible" for some farmers. But for him personally? "It's been a good year. We've been able to make some money, and you have to just count your blessings and call that a good year," he says.

McFarlane has received some irrigation water from Kings River, via the Fresno Irrigation District, but he is also pumping water from his wells. "If it weren't for the wells, we couldn't have made it work," he says.

Howitt says that there are two contrasting realities in California agriculture these days. "Some people just don't have the underground water. You meet these people and they really are in poor shape," he says. But where there is water, "you have investors pouring money into planting these almond trees at a rate that they've never seen before."

But this is also where the environmental damage comes in. Those underground reserves are getting depleted, wells are going dry, and in many locations, the land is sinking as water is drawn out. When this happens, it permanently reduces the soil's ability to absorb and store water in the future.

California has enacted new rules that eventually should stop farmers from pumping so much groundwater, but for now, it continues. This year, California's farmers are still pumping enough groundwater to replace about 70 percent of the shortfall in surface water, according to a new UC Davis report.

Such extensive use of groundwater can't continue forever, and high commodity prices probably won't either. Milk prices already have fallen, and if China stops buying so much of California's nut production, those prices may crash as well.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.