Food delivery service Grubhub will pay more than $3.5 million to Massachusetts restaurants and a $125,000 fine to the commonwealth for illegally charging its regular fee to restaurants during the pandemic — when it was legally barred in this state from doing so.