Biotech firm Illumina will buy back cancer-detection startup Grail in an $8 billion deal that will buy out investors including Amazon chief Jeff Bezos, the companies said Monday.

The deal — announced less than two weeks after Grail filed for an initial public offering — will give Illumina access to Galleri, a medical test that can detect dozens of types of cancer.

“Galleri is among the most promising new tools in the fight against cancer, and we are thrilled to welcome Grail back to Illumina to help transform cancer care,” Illumina president and CEO Francis deSouza said in a statement.

Illumina founded Grail in 2016 and spun it off into a separate company. It went on to raise about $2 billion to develop Galleri and other technologies, winning investments along the way from Bezos, Microsoft co-founder Bill Gates and pharmaceutical giant Johnson & Johnson.

The buyback deal will give Grail stockholders — including Illumina, which currently holds 14.5 percent of Grail’s outstanding shares — $3.5 billion in cash and $4.5 billion worth of Illumina stock, according to a news release. Illumina said it expects to close the transaction in the second half of next year.

“We are excited about this next step in our journey to transform cancer detection and outcomes and create value for patients and their families and communities, health care providers and payors, employers, and stockholders,” Grail CEO Hans Bishop said in a statement.

In its Sept. 9 IPO filing, Grail revealed a net loss of $244.8 million for last year after losing more than $275 million in 2018. The company acknowledged that it won’t launch Galleri commercially until next year and said it does not “expect any near-term revenue to offset our ongoing operating expenses.”

With Post wires