"Sinners" refers to Jews who did not follow the Law of Moses well. No one followed it perfectly, but "sinners" would be those who did not even attempt to adhere to it. The Gospel writers portray them not as evil people per se. We don't really know what percentage of the populace followed the law strictly. Indeed, one of the missions of the Pharisees was to educate people to do exactly that, to realize the biblical ideal of "a kingdom of priests and a holy nation." To quote Britannica:
The Pharisees tried to democratize the Jewish religion and remove it
from the control of the Temple priests. The Pharisees asserted that
God could and should be worshipped even away from the Temple and
outside Jerusalem. To the Pharisees, worship consisted not in bloody
sacrifices—the practice of the Temple priests—but in prayer and in the
study of God’s law. Hence, the Pharisees fostered the synagogue as an
institution of religious worship, outside and separate from the
In speaking of "sinners," the Gospels do not refer to Gentiles. Gentiles are a separate category, to whom most of the Mosaic laws do not apply. The Pharisees had diverse attitudes toward Gentiles. Jesus indicated that some Pharisees hoped to teach God's laws to foreigners. (Matthew 23:15:
“You traverse sea and land to make one convert.") Other Pharisees refused to engage with Gentiles. The Talmudic story of Hillel and the Gentile exemplifies the attitudes of the two main branches of Pharisaism on this issue. (Hillel was the grandfather of the famous Gamaliel of Acts 5, incidentally.) Nor is there much evidence that the Pharisees were given to greed, other than the statement that they, as teachers of the Law, sought places of honor in synagogues and banquets (Matthew 23:6) The accusation of greed is more apt when applied to Sadducees, who were notorious collaborators with Rome in order to gain wealth and power.
As for tax collectors, they were indeed detested by Pharisees and the common people alike, because they served as Roman agents in a way which touched the people directly, even more than the Sadducees did by controlling the Temple and the high priesthood.
The term "tax collectors and sinners" is found seven times in the synoptic gospels and zero times in the Gospel of John. Since the synoptics borrow from one another freely, the frequency of the phrase is not as great as the OP suggests. Moreover, in the Gospel of Luke, the term "sinners" is used more often alone than in conjunction with tax collectors. In virtually all cases, "tax collectors and sinners" is used in order to emphasize Jesus' mission: “Those who are healthy do not need a physician, but the sick do." (Luke 5:31 etc.) In that sense, Jesus practiced what the Pharisees preached: to bring the masses to God way.