Contingent as in if you don't gain a card there will be no cost reduction? No, there is no "if you do" clause and therefor it doesn't matter if you fail to follow the instruction.
In fact, I think it's edge case-free impossible to occur since curses/ruins, coppers and estates needs to be out for that to even be considered.
That is what I was thinking.
The word "Then" on the card confused me a bit I guess. It could matter for trader or posession, or anything with "when you would gain" timing, play inventor, gain an estate, reveal trader to instead gain a silver instead. (why not just use inventor to gain the silver, but I digress) Do I still get the cost reduction?
Since its understood you resolve things top to bottom, the fact that the word "then" is on the card leads me to believe that Gaining a card costing up to $4 has to happen to get the cost reduction.