That spot on the headset is not normally loaded during steady-state riding, because the weight is normally on the opposite side of that bearing.
Option 1 The prime suspect for this is a frontal impact - the bike was ridden into an immovable object like a car or kerb/curb or pothole, and the front wheel was pushed back. The top of the fork was levered forward, stressing the head tube which cracked.
Option 2 The headset bearing was forced into an undersized hole with pressure. Over time the stressed headtube cracked, but this happened after painting.
Option 3 The paint has cracked due to... something ?
I would say the seller is being potentially dishonest not disclosing details they know, or they may literally not know of this problem. On balance, I'd buy a different bike or use this one as a parts-donor only.
Checking If you already owned this bike, your best action is to completely disassemble the headset and remove the fork and upper bearing race. This lets you see the affected area from the other side.
If the crack propagates through to the inside, the frame is not safe to ride. Aluminium would be a write-off, but a carbon fibre specialist may have skills to repair it. In that case, consult a frame specialist in your area in person.
If you still can't tell, use a sharp pick or point to remove paint (no sanding or filing) to see the surface underneath. If it is just a crack in the paint then sand it smooth and apply a suitable colour of touchup paint, either automotive or nail polish. You may need 3-6 very thin coats allowinfg dry time, and then some clearcoat on top.
Risk If the crack was all the way through, it becomes a focus for stresses and may continue to spread. A frontal impact (like a pothole) while riding could result in excessive damage and immediate failure larger than what you might expect from an undamaged bike.
Gradual crack propagation might be missed too - the bike suddenly gets really floppy and you stop before it fails outright.
Summary You buy an undamaged and safer bike. Share this with the owner so they can act ethically (part it out and scrap frame, if they were OP then they check warranty, etc.) There's always another bike.