The text is a metaphorical saying that implies there is a cost or catch to anything that appears to be free, such as the danger for a mouse trying to get cheese from a trap. It does not exploit different meanings of a word or similar-sounding words for humorous effect.
The only free cheese is in the mouse trap .