All bicycles must be registered to the legal owner and have a bōhan-tōroku sticker affixed in a visible position.
There is normally no meaningful punishment or penalty for an owner who does not do this. However, not having a sticker can cause extra hassle if you're stopped by the police; they may suspect the bike is stolen unless you can prove otherwise.
Registration costs 500 yen. Tax should not be charged, but some naughtier bike shops add the tax equivalent.
To register, as the new owner you also have to produce some valid ID.
Hang onto the owner's copy of the registration document, so that if your bike is stolen you will know what the registration number was.
If you have brought a bike with you from outside Japan, or have had one shipped, it may be possible to register if you have a valid receipt. You will need to negotiate with a friendly bike shop to process the registration for you; the shop is under no obligation to process registrations for bikes that they have not sold. (But a shop must register every bike that they do sell!)
If someone sells you a bike, you should get them to complete the attached form so that you can transfer ownership and registration to yourself.
If you are selling a bike, complete the attached form so that the buyer can transfer ownership and registration of the bike to themselves.
Much more information about the various permutations of the registration process is available from the web site of the responsible amakudari-kyōkai™.