Just because the law allows it doesn’t mean a company must do it.
It may be legal for instacart to take the tip money but it’s their decision to do so and they deserve the blame.
It’s wrong because the people paying the tip generally believe it goes to the person providing the service, not to the company. And it subverts the purpose, which is to incent and reward good personal service.
So the company ends up screwing their workers, deceiving their customers and disincentizing good service.
Legal, but wrong and stupid.