A mudblood is just the same as a muggle as far as heritage is concerned. A eg fifth generation wizard with purely mudblood ancestry would still be a mudblood.
As the pureblooded wizards are all interrelated Harry is related to Malfoy, but probably only by a connection as tenuous as eg third cousin five times removed.