You can copy these into your /Library/Printers/ folder. Once you've expanded the first PKG file, you'll get another folder with the same file (HewlettPackardPrinterDrivers.pkg), run the same command on this file, and it'll give you all the files you need. Pkgutil -expand PATH-TO-PKG-FILE PATH-TO-EXPAND-TO Open the DMG file and mount it, then go to Terminal and use this command to extract the PKG files:
On Big Sur (M1 or Intel), you can extract the files you need from the HP Printer Drivers 5.1 package from Apple to install the driver for the HP Laserjet 1018-1020-1022 without the need to run the installer.
If the new drivers from Apple don't do it for you, you can try the following (which I have also posted on Apple's support forum to help others who are having the same issue):