Who wrote the משנה ברורה?
The משנה ברורה שי”ח ס”ק י”ד writes:
” Food that was cooked for a sick person on Shabbos, even healthy people may eat it immediately on Motzei Shabbos. (Since it was cooked בהיתר there is no problem of בישול עכו”ם & no need of בכדי שיעשו) “
The Dirshu Mishna Berurah quotes from the (שביתת השבת & שונה הלכות (ר’ חיים קניבסקי שליט”א who ask from the מ”ב שכ”ח ס”ק סג
“Food cooked for a חולה on Shabbos may not be eaten on Motzei Shabbos even for the חולה, since you can cook for him fresh food on Motzei Shabbos.”
The שביתת השבת & שונה הלכות answer various answers to solve the contradiction in the מ”ב.
In the ספר כל ספרי החפץ חיים ח”ג There is a chapter written by the son of the Chofetz Chaim הרב אריה לייב הכהן זצ”ל.
He writes that the Chofetz Chaim paid him a monthly salary of 20 Rubles so that he will help him with writing the מ”ב.
The first volume of the מ”ב and most of volume 3 was written entirely by the Chofetz Chaim.
The rest of the מ”ב R. Aryeh used to send to the Chofetz Chaim his pieces of Mishna Berurah & Biur Halacha. The Chofetz Chaim reviewed (edited) and entered them in the Sefer.
When the Chofetz Chaim wasn’t satisfied he rejected it and entered his own.
There were times when a Halacha somehow slipped through and was entered even though the Chofetz Chaim was not in agreement with it.
Therefore you will find at times contradictions in the מ”ב.