Two Oregon college students allegedly managed to scam Apple out of nearly $900,000 through a scheme involving counterfeit iPhones, according to the federal government.

The scam revolved around counterfeit Apple iPhones that were shipped to students Quan Jiang and Yangyang Zhou from "an associate" in China, the government claims. Jiang and Zhou would allegedly submit the fake iPhones to Apple for repair under the company's warranty program and Apple, in many cases, would send them authentic iPhones as replacements. In total, the pair submitted thousands of warranty claims for counterfeit iPhones through the end of 2017, according to complaints filed by the federal government in March 2018 and March 2019.

Jiang, who was reportedly a student at Oregon State University at the time, estimated that he submitted over 2,000 warranty claims in 2017 alone, the government said, and Apple's records show over 3,000 claims in total attributed to Jiang. In every case, Jiang claimed that the iPhones could not be turned on, which turned out to be the crux of the scam, according to the government.

"Submission of an iPhone that will not power on is critical to perpetuating iPhone warranty fraud, as the phone will not be able to be immediately examined or repaired by Apple technicians," and the company will often have to send a replacement iPhone under its warranty policy, the government wrote in its complaint.

While Apple was able to determine that many of the counterfeit iPhones Jiang submitted were not authentic, the company still accepted 1,493 of the phones the student sent in as authentic and provided him with replacement iPhones. At a cost of $600 per iPhone, according to the company's estimates, those replacements resulted in losses of $895,800 for the tech giant, the government said.

Apple did not immediately respond to CNBC's request for comment.

Jiang told authorities that he regularly received packages with 20 to 30 iPhones from "an associate" in China with instructions to submit them to Apple under warranty claims. After receiving replacement iPhones, Jiang would ship them back to China, where they could be sold. The unnamed "associate" would pay a portion of the profits to Jiang's mother in China, who would deposit the funds into a bank account that Jiang could access from the US.

Last year, federal agents searched Jiang's Oregon home and found over 300 counterfeit iPhones, along with shipping records and documents for warranty claim submissions. They also found several boxes that had been addressed to Zhou, who has been named as Jiang's accomplice.

Zhou was studying engineering at Linn Benton Community College last spring, according to The Oregonian.

Apple records show that over 200 iPhone warranty claims have been submitted in Zhou's name, the government wrote in a complaint, filed in March 2019, that accuses Zhou of submitting false or misleading information on an export declaration. Zhou faces fines of up to $10,000 and five years in prison.

Jiang, meanwhile, was accused of wire fraud and trafficking in counterfeit goods in federal court last year. He faces fines of up to $2 million and 10 years in prison for the trafficking accusation, and another possible 20 years in prison for wire fraud.

Both Jiang and Zhou claim that they were not aware the phones shipped to them, which they submitted for warranty claims, were counterfeit Apple iPhones, according to the government's filings. Jiang told federal authorities that Apple never notified him that any of the phones were counterfeit.

"With respect to Mr. Zhou, the government has the case completely wrong," Jamie Kilberg, an attorney for Zhou, wrote in an emailed statement to CNBC. "Mr. Zhou had no knowledge of any alleged counterfeiting scheme, and when the actual facts come out, we are confident he will be vindicated."

Celia Howes, an attorney for Jiang, declined to comment for this article.