Polonius has just spoken with Claudius and Gertrude. They have decided to eavesdrop on a conversation between Hamlet and Ophelia in order to determine if Hamlet's melancholy/mad behavior is a result of love sickness. Prior to this, Polonius speaks with Hamlet alone. Polonius believes he is a cunning man, and uses his wit to get information from Hamlet. However, this scene reveals that he has no idea what Hamlet's madness is really all about. Polonius asks Hamlet if he knows who he is. Hamlet toys with him, saying that he knows Polonius as a fishmonger.
Hamlet actually does know who he is but calls him a fishmonger (one who sells fish). Perhaps, Hamlet is insinuating (to himself, since Polonius does not get the joke) that Polonius is "fishing" for information. Or, Hamlet could be suggesting that something smells "fishy" with Polonius. Hamlet suspects that Polonius (and later, Rosencrantz and Guildenstern) have been coached by Claudius to spy on him. So, when Polonius replies that he is not a fishmonger, Hamlet responds with the line "Then I would you were so honest a man." In other words, Hamlet says that he wishes Polonius was as honest as an actual fishmonger. He is basically calling Polonius a liar (or dishonest) to his face, without Polonius understanding exactly what this means.
In Act II scene 2, Hamlet’s line “Then I would you were so honest a man” is spoken to Polonius in response to Polonius saying “Not I, my lord” when Hamlet says that Polonius is a fishmonger. The meaning of Hamlet’s response is literally that he wishes Polonius were as good a man as a seller of fish is. The implied message, which Polonius fails to recognize, is that Hamlet thinks Polonius is dishonest. Some scholars think that “fishmonger” may have been a slang word for “pimp,” in which case Hamlet’s implication that Polonius is less respectable than a person of such ill repute is very insulting indeed. In the rest of their conversation, Hamlet uses other sarcastic language that lends credibility to the harsh interpretation of "fishmonger" and what that means in comparison to the integrity of Polonius.