Is there a way to make a QR code that contains an html file? (no URL) Like a QR that, scanned, makes your smartphone read the html code and run it in your browser without using a public server
No.
QR codes contain text.
While it would be possible to write a reader that could detect HTML and parse it automatically, that isn't normal behaviour.
The closest you could get would be a data:
scheme URL.