That would not detect these bars. They are surrounded by a fairly thick gold layer, not gold plated.
Without knowing the specifics of the detector, you cannot make such a judgment (what energy/intensity of x-ray source, sensitivity of detection). Some XRF devices will probably not work, some will work. But this is a very specific application. I'm sure some mfg. will come up with a dedicated device that targets this specific application.
Believe me, I understand the physics here. My minor subject in grad school was nuclear science, a fair segment of which was about non-destructive testing using radiographic devices. I'm sure plain old x-radiography with Co-60 and film would quickly distinguish such fake bars....and that the new fully electronic and computerized (and much more sensitive) detectors would do even better.