OK, well you are stuck. Here is what happened. Your friend on his printer has Cartridge Protection turned on. This means that ANY cartridge used in his printer will now be protected and LOCKED to his printer only.
Trying to take that cartridge to another HP printer will show you that message that you have now. There is NO way to fix the cartridge once it is protected.
I would make your friend buy the cartridges that will only work in his printer now. He should turn OFF Cartridge Protection in his printer so this does not happen again. He must use the printer's EWS to change this mode.
Again, your cartridges will only work in his printer now, forever. Give them to him will a bill to buy you replacements.