X-ray-laser interaction with matter and the role of multiphoton ionization: Free-electron-laser studies on neon and helium