This happened because camera applied surplus of sharpening. Sharpening means for a computer to find a lightness transition and make the dark part of it darker and the lighter part lighter. If one applies disastrous amount of sharpening (as camera clearly did) artifacts are inevitable - the ligher part will become clipped white and the darker part will become clipped black.
You will get similar artifacts if you use aggressive tonemapping (which is sharpening with very big radius) but at a larger scale.
Here I reproduced the defect which original image has, it is visible on tilted parallel lines.
- set your camera to apply less sharpening (i.e. find "sharpness" setting and reduce it)
- if the sharpness does not satisfy you, increase contrast instead
- Record RAW files and set everything in RAW processor.
P.S. Mostly copypasted from similar question.