In the security game between the challenger and the adversary for the security definition of public key encryption, the challenger creates and gives the public key pk to the adversary. The adversary chooses two messages of equal length $m_0$ and $m_1$ and asks the challenger to encode these. Finally, the adversary has to guess which message was encoded.
Isn't it always possible for the adversary to do this, since she knows the public key and can simply use the encryption algorithm to create the ciphertexts for both the messages and output the one which matches the challenger's reply?