Update:
The Government appealed against the High Court's finding of apparent bias, and in January 2022 the Court of Appeal overturned the original ruling. Michael Gove's actions in awarding the contract were, therefore, not only not illegal, but also not unlawful. Good Law Project plans to ask the Supreme Court to hear a further appeal.
Original answer follows:
Just to correct you slightly, as this is an important point - Michael Gove was not found to have acted illegally, but unlawfully. The distinction is that the Court found (judgement) that the decision to award the £560,000 contract to Public First "gave rise to apparent bias", making it unlawful - as opposed to actual bias, which would be a criminal offence and illegal.
The consequences of this ruling are not yet clear - the hearing has been adjourned until an as yet undetermined date, at which point the Government has an opportunity to appeal. However, in the application for judicial review, the Good Law Project sought relief in the form of:
a declaration that the Decision of 5 June 2020 to award the
Contract to Public First was unlawful;
an order quashing both the Decision and the Contract executed
pursuant to that decision;
such other relief as is necessary to give effect to the Court's
judgment.
The Government is not free to break the law in this way, as clearly they can be taken to court, their actions declared unlawful and the consequences above can be imposed.
Convention would dictate that following a decision of this kind, an investigation into whether a breach of the ministerial code occurred would follow, and the results of that investigation would be presented to the Prime Minister who is the "ultimate judge of the standards of behaviour expected of a Minister and the appropriate consequences of a breach of those standards". Presumably, Michael Gove could be found to have breached the code under a provision of section 7:
7.1 Ministers must ensure that no conflict arises, or could reasonably be perceived to arise, between their public duties and their private
interests, financial or otherwise.
Recently, an investigation into a similar breach by Matt Hancock, the Secretary of State for Health and Social Care took place. Mr. Hancock was found to have breached section 7.7 of the code by the Independent Adviser on Ministers' Interests by not declaring a relevant interest in a company (Topwood Ltd) - of which he owned 20% - when it was awarded a framework contract by NHS Shared Business Services Ltd in 2019. As Mr. Hancock subsequently declared a financial interest in the company in March 2020, the independent adviser found that his actions were "as a result of his lack of knowledge and in no way deliberate, and therefore,
in technical terms, a minor breach of the Ministerial Code". As a result, Hancock was not asked to resign by the Prime Minister.
Depending on whether Mr. Gove is investigated and found to have breached the code, he may be asked to resign from the Government. He will personally face no further consequences as a result of this judicial review, as actual bias was not alleged nor proven - this would have led to criminal proceedings under misconduct in public office.