As the Supreme Court ruled that state government employees cannot be forced to pay so-called "fair share" fees to labor unions, President Trump warned of a "big loss for the coffers of Democrats."

"Supreme Court rules in favor of non-union workers who are now, as an example, able to support a candidate of his or her choice without having those who control the Union decided for them," Trump said in a tweet after the 5-4 decision.

The nation's highest court said Wednesday, in one of the last cases decided this term, that the so-called "fair share" fees non-union members had to pay in roughly two dozen states violated the First Amendment rights of workers by compelling them to support unions they might disagree with.

Sen. Jim Inhofe, R-Okla., heralded the Supreme Court's decision as a "win for the First Amendment" and said he was "pleased" the court "stood up for freedom of speech again today."

“Today’s decision is a win for teachers, police officers, firefighters and public servants, who shouldn’t be forced to join a political organization or government union," Rep. Cathy McMorris Rodgers, R-Wash., said in a statement. "Workers should be trusted to make that decision for themselves, and the Supreme Court affirmed today their First Amendment right to do just that. This decision rightly upholds our freedom of speech and freedom of association. Workers shouldn’t have to abdicate their rights just because they have jobs in public service.”

But the decision wasn't received positively by all.

"Corporate interests have been rigging the system against workers for decades -- and the Supreme Court just handed those interests a huge victory in Janus v. AFSCME," Sen. Elizabeth Warren, D-Mass., said in a tweet. "But I've got news for the billionaires behind this case: we're not going anywhere."

Sen. Bob Casey, D-Pa., accused the Supreme Court of "showing its opposition to the rights of working families and commonsense."

"If someone directly benefits from the negotiations by a union, it makes sense that they should pay a fee to cover the costs associated with this work and not get a free ride," he said. "If all workers benefit, it is only right that everyone contributes a fair share fee. This effort in the courts was nothing more than a well-funded attempt by corporate billionaires to dismantle unions."

Democratic National Committee Chair and former Labor Secretary Tom Perez and Vice Chair Maria Elena Durazo called the decision "nothing more than blatant and disgraceful union busting that could slam the door on millions of hardworking Americans trying to make it into and stay in the middle class" in a joint statement. They said the addition of Justice Neil Gorsuch to the court "was first and foremost about winning the Janus case and taking rights away from workers."

The Associated Press contributed to this report.