Because OTA is supported by advertising. Cable companies also sell advertising. They expect to be paid for their product.
The cable company is charged by the local television company to retransmit what is free over the air. The cable company PAYS the local network affiliate. The cable company can not insert their own advertising into the feed. So the local network affiliate is making money from advertising THEN expecting the local cable subscribers to pay an additional fee to receive the same programming.
Has nothing to do with selling advertising - the affiliates don’t permit the insertion of ads by the cable provider.