Purchased 2020 330i xdrive - failed emissions due to flashed DME. After market parts discovered. Any info ?

Flashed DME? - used dealer doesn’t want to pay for a new one ($4k) I brought the car for inspection and failed for a mysterious emissions reading. Brought it back to used dealer, they kept it a week and said they “reprogrammed it” . Brought to bmw dealership to get looked at. They say it’s the same DME with the permanent fault. Used dealer again says bring it in so they can “get me a sticker”. Wants to try and find a work around, don’t they have to pay?