It depends how the ballast is constructed.
If it uses capacitive dropper, it is not ok.
Others, so a switch mode DCDC or a linear CCR based are OK (they both start with the rectifier).
Quite a reliable way to say is to try to supply it behind a bridge rectifier.
If it glows normally at full power, it uses ballast compatible with the rectangularish "modified sinewave" of those UPSes.
If it only flashes at power ON (or not at all) and then glows very dimly, there is very high chance it uses the capacitive dropper circuit, so incompatible with the MSW.
There could be some oddball topology that behaves on this test like the capa-dropper but actually be OK with the MSW, but I would not rely on that...
Which one of these ballast implementations is the most common one in retrofit (e27) led lamps?