I agree, but it still uses resources and those don't come for free (hardware, electricity, cooling, maintenance staff, housing, etc.)
It's really difficult to assign monetary value to all these aspects and weighing them against each other in a fair manner.
The consent issue is a difficult legal aspect as well. Github's ToS Section D.4 clearly states they retain the rights to process your content and
parse it into a search index or otherwise analyze it on our servers
It can be argued that using the content to train an AI model falls under "analysing it on our servers". Also It also does not grant GitHub the right to otherwise distribute or use Your Content outside of our provision of the Service
If CoPilot is part of their service, it's in their right to distribute the content, e.g. by means of CoPilot as a processed part of the model.GPL and other licences don't place restriction on the usage as training data. It's currently a very murky legal grey area. Licences need to adapt to this new form of usage pattern.