As if Apple needed the cash, the company has discovered a way to make tens of millions of dollars off of old, broken, unwanted iPhones.

In its annual environmental report released this week, Apple said it recovered 2,204 pounds (more than a ton) of gold from recycled iPhones, iPads and Macs last year. That's $40 million worth.

Gold is used in consumer electronics because it is highly averse to corrosion and an excellent conductor of electricity. Silver is actually the best conductor, but it corrodes easily. Copper is super-cheap, but it moves electrons too slowly for some of the most important computing tasks.

Of the 90 million pounds of e-waste through its recycling programs, Apple said 61 million was in reusable materials. Gold made up a relatively trivial amount. But since gold is currently trading at more than $1,200 per troy ounce, it's among the most valuable materials it pulled from all those old gadgets.

Apple (AAPL) said it also collected 23 million pounds of steel; 13 million pounds of plastic; 12 million pounds of glass; 4.5 million pounds of aluminum; 3 million pounds of copper; and 6,600 pounds of silver.

Apple has been ramping up its recycling programs in recent years, boosted by its Apple Renew program that lets customers recycle any Apple device at an Apple Store.

The company also recently started using a new experimental line of robots dubbed Liam. They're designed to disassemble 1.2 million phones a year, sorting all their various components. Liam prototypes are operating in California and the Netherlands.

Apple says it reuses many of the materials it extracts from the recycled phones. That reduces the need to mine those metals and materials from the earth.