Foreign Military Sales (FMS) programs allows the participating countries to share most of the setup cost, except some high end technology that is country specific, it’s mainly divided by per airframe basis.
When you have the US Air Force in a program and they purchase a bazillion aircraft, things get relatively affordable.
Well, the US left and nobody want to spend billions of dollars into the development of this aircraft (most of the problems are the airframe not radar I heard, citation needed) and end up with just two aircraft and then deal with internal news about how they spend billions of dollars per aircraft when commercial airlines are so much cheaper.