What determines the weapon sold by the black market weapon trader?

There is a 50% chance he will renege. If not, the weapon is completely random (probably with uniform distribution, as with other random choices in the game, but maybe biased by the rarity attribute).

You can verify this in the NEBULA_WEAPONS_TRADER_LIST event data.