What factor primarily influenced the shift from feudalism to capitalism during the Middle Ages in Europe?