Depending on how much detail you want, you can read the legal ruling in Flytenow Inc. vs FAA, which is the most recent and highest-level ruling on general aviation flightsharing. The Supreme Court declined to hear an appeal.
Essentially, Flytenow wanted to let pilots find passengers willing to share the costs of a flight. They emphasized repeatedly that all decisions about if and when to fly, the route to take etc. would be made by the pilot, not the passengers. On the other side, the FAA said that by advertising for passengers, pilots would be holding out and that makes it a commercial operation. There were plenty of arguments on both sides and ultimately the courts decided that the FAA was acting consistently with previous decisions and regulations.
Flytenow made three legal arguments, all of which were judged invalid on appeal:
- Advertising for passengers is protected free speech under the First Amendment
- Private pilots' equal protection rights under the Fourteenth Amendment are infringed if they can't share costs
- The FAA's ruling was vague
If you read the court's decision, you can see that they basically agreed with the FAA that protecting passengers justifies limiting what private pilots can do:
The FAA’s distinction between pilots offering expense-sharing services
on line to a wide audience and those offering expense-sharing services
to a limited group is justified: holding out to the public creates the
risk that unsuspecting passengers, under the impression that the
service and its pilots lawfully offer common carriage, will contract
with pilots who in fact lack the experience and credentials of
commercial pilots.
To put it even more simply, the basic difference between Uber and Flytenow is that the FAA believes that the general public can identify a bad driver, but not a bad pilot. That's the fundamental reason for having commercial licenses, part 135 etc.