Is this sentence an imperative sentence, or does it have conditional meaning?
You hang around with riffraff like the Weasleys and that Hagrid, and it’ll rub off on you.
It's a complex situation.
Sentences like the presenting one are clearly intended to urge, if not impose, some kind of behavior on the addressee (though the addressee in this case is only a generic you, the same sense as one, but faluting a couple levels lower).
So in that they are like imperatives. However, it can be shown (as I do in my paper) that they aren't real imperatives, syntactically. They must be a different construction, mimicking an imperative. It's clear that the construction does have some conditional meaning --
which is the beginning of a Modus Ponens syllogism:
The second line is implied in context, and the conclusion follows.
An extreme case of this is
which means something like (boldfaced omissions)
It could conceivably be read as an imperative (or, more correctly, an impositive as John Lawler explains in the comments):
But given the context, it's unlikely that the speaker meant it as a command. (After all - who would command someone to go get bad influences from riffraff?) It's more likely to be interpreted as a conditional: