Charge-transfer excitations in lanthanum compounds measured by resonant inelastic x-ray scattering at the M5 edge