All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
If a person is eligible for the money that he gets from the state, then he is allowed to spend it as he wishes, including for the performance of Hajj. But if he is not eligible to get this money, then he is neither allowed to receive it nor to spend it in anyway, including for Hajj. If he is not eligible to get this money and performed Hajj with it anyway, then his Hajj is valid but he is sinful, according to the preponderant opinion of the scholars.
Allah Knows best.