Written in the style of a riddle or saying, this short poem sets two ways of losing the heart side by side. The first is a heart shut away in a closet, which the speaker calls "a loss of great concern." It's quiet, hidden, something to worry about. The second is a heart held in "the prison of sex," and here the tone turns colder: such a heart "will find too little to grieve for." Grief seems to fade when desire takes over, and the speaker finds that more troubling than the closet.
The last two lines are harder to pin down. "Ruin is our ointment" suggests we soothe ourselves with the very thing that damages us. "The other" is unclear, but it seems to be a rival comfort or remedy, and it is said to match "any pain." The poem leaves this open, and the mood is wry, bleak and puzzling, like a warning whose meaning you have to work out for yourself.