It's called a "common mode" choke. It suppresses switching transients from inside the UPS getting back out on the power line.. either hot or neutral. We use them in amateur radio coaxial transmission lines to suppress "common mode" currents that travel back on the outside of the coaxial cable braid and create "arcs and sparks" back in the shack. Problem usually only occurs at higher power levels, but it is always a good idea to suppress common mode currents. Many hams suppress common mode RF without using the ferrite cores by simply making a few loops of out of the coax where it attaches to the antenna, holding the loops together with black tie-wraps or even electrical tape. Four or five turns on a eight or ten inch diameter provides enough inductance to suppress amateur radio RF from propagating back down on the outside of the coax. If that isn't enough, they feed the coax through ferrite cores. Some hams can get pretty carried away with this, placing a dozen or more cores on the coaxial cable in an attempt to keep RF out of the shack.
At the switching frequencies of your UPS (several kilohertz most likely) it requires more inductance to get the same effect, hence the powdered iron cores to wrap the wire around. Sounds like you have unearthed a real treasure chest thar, matey!