There are four states in the United States that call themselves commonwealths: Kentucky, Massachusetts, Pennsylvania, and Virginia. The distinction is in name alone. The commonwealths are just like any other state in their politics and laws, and there is no difference in their relationship to the nation as a whole.
So why are they called commonwealths? Well, their constitutions simply deem them such. According to one commonwealth's website (Massachusetts—the one in which Merriam-Webster is headquartered), the term commonwealth was preferred by a number of political writers in the years leading up to 1780, when the Massachusetts constitution officially designated the state as such; the preference is believed to have existed perhaps because there was "some anti-monarchial sentiment in using the word commonwealth."
That notion might seem strange to those familiar with another use of the word commonwealth. The Commonwealth with a capital C is an association of sovereign states consisting of Britain and a number of countries that were formerly under its rule. Membership in the Commonwealth is voluntary, and not restricted to former colonies; both Mozambique and Rwanda—the two most recent members to join—are members despite having no historical tie to the British Empire.
In addition to Kentucky, Massachusetts, Pennsylvania, and Virginia, the United States has two other commonwealths, Puerto Rico and the Northern Mariana Islands, but they are of a different kind. They are not states, and have only a nonvoting representative in Congress. While residents of these islands have U.S. citizenship, they pay no federal income taxes, though they do pay other kinds of federal taxes.