The term "surfing the internet" was first used in the 1990's and has since become an idiom.
However, you could use 'surf on the internet' with pretty much the same meaning. The English language is flexible like that.
There can also be a slight difference in meaning
To surf the Internet = to go purposely from site to site or to browse.
To surf on the Internet = to browse or move from site to site randomly.
Men, in general, tend to surf on the Internet for the beauty of it, to explore its limitless possibilities, and, above all, to enjoy the challenge of making it work.
.net Magazine. 1995
Some parents believe that children must learn how to safely surf the Internet. ... PC Magazine
I have also come across " surf IN the Internet".
Surfing IN the internet would imply being deep into the net experience-- perhaps downloading files, playing games, chatting, or doing all at the same time.
"I can “surf” in the Internet for hours, reading interesting articles, watching movies or chatting with pals all over the world..."