You can buy them occasionally. You would need a special species tank with a mesh covered lid so it couldn't escape. However, octopi are short lived animals & need a relatively cool, escape proof tank. A full life span is usually only a year.

They also prefer foods like live crabs & clams. Do lots of research before you make your decision. It would at best be a temporary pet in captivity. BTW, you will rarely ever see it since it hides 95% of the time. Definitely a fascinating creature best left in the ocean IMO.
Anthony