The Laws of Rubber Bridge (2014) make clear that this behaviour is unacceptable by Dummy (my emphasis):
Law 43 - Dummy's Limitations
Dummy may not participate in the play (except to play the cards of dummy’s hand as directed by declarer) or make any comment on the bidding, play or score of the current deal. If he does so, Law 16A may apply. During play dummy may not call attention to an irregularity once it has occurred.
Dummy forfeits the rights provided in Law 42 if he exchanges hands with declarer, leaves his seat to watch declarer play or, on his own initiative, looks at the face of a card in either defender’s hand.
In many cases a comment such as you describe could not be claimed to contain unauthorized information. One obvious exception is if there is still trump out in Defender's hands, when the comment has been made particularly if one or more rounds have already been drawn. Other circumstances, such as appearing to abandon Dummy with an unplayed established long suit, might exist.
Law 16 - Unauthorized Information
A player may be subject to penalty if information is conveyed from his partner other than by a legal call or play.
A. Regarding information obtained from partner: If a player conveys information to his partner by means of a remark, question, ..., [it] is unauthorized. When the offending side has profited by use of this unauthorized information, it should, in conformance with Proprieties 1, redress any damage done to the non-offending side.
B. ....
....
A player on the offending side must not base any subsequent calls or plays on such unauthorized information. If it is determined that this has been violated and the non-offending side has been damaged, the result should be adjusted to redress any damage done to the non-offending side.
However the intent of Rule 16 is to restore equity in these circumstances. There is no penalty applied under this rule unless damage to the non-offending side has occurred (as assessed by an unbiased reasonable observer). If your game happens to have an Arbiter, there is an additional extension of Rule 16 that can be enabled by the Club to have the Arbiter make such a determination.
Dummy also has certain rights enumerated in Law 42, which are lost if Dummy engages in specific activities noted above. If Dummy has forfeited his rights and subsequently attempts to use them certain procedural penalties apply to Declarer, as noted in the second half of Law 43.
The Proprieties also state:
Proprieties
1. General Principles
These Laws cannot cover every situation that might arise, nor can they produce equity in every situation covered. .... The guiding principle: the side that commits an irregularity bears an obligation not to gain directly from the infraction.
To infringe a Law intentionally is a serious breach of ethics, even if there is a prescribed penalty that one is willing to pay. The offence may be the more serious when no penalty is prescribed.
....
Furthermore, the following are considered breaches of propriety: ...
H. indicating approval or disapproval of a call or play.
It is eminently obvious here that Dummy is both in violation of the Proprieties, in a manner, as noted above, so egregious that no specific penalty has been prescribed. This should be politely noted to Dummy when such behaviour occurs, perhaps by quoting the paragraph above from The Proprieties.
Note that:
The Scope of the Laws
The Laws are designed to define correct procedure and to provide an adequate remedy whenever a player accidentally, carelessly or inadvertently disturbs the proper course of the game, or gains an unintentional but nevertheless unfair advantage. An offending player should be ready to graciously accept any penalty set forth in these Laws or any adjustment or decision of an Arbiter
And, if all else fails in regard to a recalcitrant offender
These Laws do not deal with dishonorable practices where ostracism is the ultimate remedy.
Update
In any organized competition the organizing committee has the right (and should publicize in the conditions of contest) to impose additional penalties, up to and including expulsion from the event, for repeated violations of The Proprieties, whether or not otherwise covered under The Laws of Rubber Bridge.