At least that is how I understood it. I hesitate to be overconfident when speaking about Eastern Philosophy as Im not close to being an expert.
Confucius has much to say about governance, but here it seems hes more interested in giving advice about how to interact with good or bad states. I believe hes advising his students that theres virtue in engaging with and climbing the ranks of a just state, but to do so to enrich themselves in an unjust state is vice. That is, the shame referred to her resides in the student, not the government. Translating The Analects will always contain a degree of interpretation because of differences in syntax, culture, and available vocabulary.
The following are a few different translations of the relevant passage, but they all seem to be directed at guiding students along the way of the good.
When the Way prevails in the world, he appears; when the Way is lacking, he retires. When the state follows the Way, being poor and lowly is a cause for shame. When the state is without the Way, being rich and eminent is a cause for shame.
Confucius, & Watson, B. (2007). The Analects of Confucius. Columbia University Press.
When the dao prevails in the world,
appear; when it does not, hide.
When the dao prevails in a state, to
be poor and of low rank is shameful; when
the dao does not prevail in a state, to be
wealthy and of high rank is shameful.
Robert Eno
The Master said, Have unshakable trust in [the moral path you pursue]. Love learning. Hold on to the way of the good until you die. Do not enter a state threatened with danger. Do not reside in a state embroiled in conflict. Show yourself when the moral way is evident. Seek reclusion when it is not. When the moral way prevails in a state, being poor and lowly is a cause for shame. When the moral way does not prevail in the world, having wealth and position is a cause for shame.
Annping Chin