Hamlet is doing double-speak the whole conversation with Polonios (Act 2 Scene 2), alternately trying to make Polonios think that he is mad, or insulting the older man.
HAMLET: Excellent well. You are a fishmonger.
Here Hamlet is insulting Polonios (a fishmonger was a lowly, smelly personage in Hamlet's time), and also saying that Polonios is "fishing" for answers from Hamlet. This also makes Hamlet look like a madman, in that he does not recognize Polonios, whom he knows so well.
HAMLET: Then I would you were so honest a man.
There are several puns in "honest". Polonios is trying to get information from Hamlet on the sly, so that makes him, in a way, "dishonest". Also, the wily courtier to the corrupt king does not take kindly to being told he is not as honest as a humble trader like a fishmonger. There is also the sexual pun, in that Hamlet may be in love with his daughter -- sexual virtue in a woman was called "honesty".
HAMLET: For if the sun breed maggots in a dead dog, being a good kissing carrion—Have you a daughter?
This is more complicated, using death imagery (remember, Hamlet was considering suicide in Act I) and a philosophical puzzle -- that the sun, a god-like celestial body, "kisses" (touches") rotting flesh and from that touch breeds maggots (the larvae of flies). This is a comparison, perhaps, to the "sun" of the present King (Claudius) -- who has certainly caused carrion (the murder of the old king,) and might be considered to bring maggots (by being with Gertrude).
The sun imagery continues with a comment about Ophelia.
HAMLET:Let her not walk i' th' sun. Conception is a blessing,
but not as your daughter may conceive. Friend, look to't
Zeus represented the sun in Greek mythology -- and Zeus was known to fall on unsuspecting human maidens and make them pregnant. This is a continuation of the sexual pun from above. There is also the play on the two meanings of "conceive" -- to bear children, and to understand. This is also a veiled insult on Polonios through his daughter, implying, perhaps, that Polonios is a fool.
HAMLET: Slanders, sir; for the satirical rogue says here that old
men have grey beards; that their faces are wrinkled; their
eyes purging thick amber and plum-tree gum; and that they(210)
have a plentiful lack of wit, together with most weak hams.
All which, sir, though I most powerfully and potently
believe, yet I hold it not honesty to have it thus set down;
for you yourself, sir, shall grow old as I am if, if like a crab,
you could go backward.(215)
This, meant to look like the ravings of a lunatic, is simply an insult to Polonios for his age (stressing how much older Polonios is than Hamlet -- saying he could be as "young" as Hamlet only if he could go backwar). But is also implying duplicity on Polonios's part, in that he coud go backward on his words (and report back to the king, which he certainly would do.)
This tour-de-force of double and triple meanings is only possible because of Hamlet's high rank. Most other young men at court wouldn't dare insult Polonios, even indirectly as Hamlet does. It is Hamlet's intention to make himself appear mad in this scene with Polonios, and it is possible that, in his recklessness, Hamlet is already half-mad. He is certainly depressed and suicidal.
There are even more interpretations of this exchange than I have related. Check out a good annotated version of the play for them.