"Damning with faint praise" can be a way complimenting A by demeaning B, although it doesn't necessarily mean that.
This definition of damning with faint praise describes such usage:
The argument "attacks" a position by complimenting or praising the
opponent or the opponent's argument. However, the praise is
misdirected or unenthusiastic, suggesting that relevant, enthusiastic
praise would be undeserved.
This is the more typical definition of damning with faint praise though:
To attack a person by formally praising him, but for an achievement
that shouldn't be praised.
I just found another surprising (to me) example of damning with faint praise, which I think confirms that it may be a way of complimenting A by demeaning B. The source is venerable, and the language is lovely, so I will quote the full stanza, emphasis mine:
Peace to all such! but were there one whose fires
True Genius kindles, and fair fame inspires,
Blest with each talent and each art to please,
And born to write, converse, and live with ease:
Should such a man, too fond to rule alone,
Bear, like the Turk, no brother near the throne,
View him with scornful, yet with jealous eyes,
And hate for arts that caus'd himself to rise;
Damn with faint praise, assent with civil leer,
And without sneering, teach the rest to sneer;
Willing to wound, and yet afraid to strike,
Just hint a fault, and hesitate dislike;
Alike reserv'd to blame, or to commend,
A tim'rous foe, and a suspicious friend;
Dreading ev'n fools, by flatterers besieg'd,
And so obliging, that he ne'er oblig'd;
Like Cato, give his little Senate laws,
And sit attentive to his own applause;
While Wits and Templers ev'ry sentence raise,
And wonder with a foolish face of praise.
Who but must laugh, if such a man there be?
Who would not weep, if Atticus were he?
--An Epistle to Arbuthnot by Alexander Pope