Firstly, Imperial won't have a clue that you applied to Cambridge, unless you send them an email to let them know. Secondly, even if they were to hypothetically find out, why on Earth would they hold it against you?
The majority of people that apply to Cambridge will be rejected, just like any other medical school. These will, for the most part, be competent, clever individuals. Why would Imperial handicap themselves by disregarding one set of people without a second's consideration just based on a choice?
Whoever keeps telling you that a) is bitter about being rejected from Imperial without getting an interview, b) doesn't want you to apply to Imperial, for whatever reason, or c) a paranoid conspiracy lover who thinks the whole world is out to get them.
Whichever it is, they're an idiot.