The official name for this process is called man in the middle. This is usually used by hackers trying to extract data but, as seen here can be used in non-harmful ways as well.
Basic Diagram:
(INTERNET)=>(ISP)=>(YOU)
Explanation: Since the ISP is in the middle of you and the internet it can inject extra data into network packets.
The reason it doesn't work for HTTPS: HTTPS is an SSL wrapper for HTTP so the ISP can't inject any HTML because the HTTPS packet is encrypted and to inject data into an SSL packet you would need to decrypt, inject and then re-encrypt the packet with the modified data enclosed.
PS: And yes, your isp can read ANY HTTP(plain text) traffic.