Ok I found it - the quote is a translation of Proverbs 6, in the Old Testament.
Here's Proverbs 6.20-35
20My son, keep your father's commandment,
and forsake not your mother's teaching.
21Bind them on your heart always;
tie them around your neck.
22When you walk, they[
d] will lead you;
when you lie down, they will watch over you;
and when you awake, they will talk with you.
23For the commandment is a lamp and the teaching a light,
and the reproofs of discipline are the way of life,
24to preserve you from the evil woman,[
e]
from the smooth tongue of the adulteress.[
f]
25Do not desire her beauty in your heart,
and do not let her capture you with her eyelashes;
26for the price of a prostitute is only a loaf of bread,[g]
but a married woman[
h] hunts down a precious life.
27Can a man carry fire next to his chest
and his clothes not be burned?
28Or can one walk on hot coals
and his feet not be scorched?
29So is he who goes in to his neighbor's wife;
none who touches her will go unpunished.
30People do not despise a thief if he steals
to satisfy his appetite when he is hungry,
31but if he is caught, he will pay sevenfold;
he will give all the goods of his house.
32He who commits adultery lacks sense;
he who does it destroys himself.
33Wounds and dishonor will he get,
and his disgrace will not be wiped away.
34For jealousy makes a man furious,
and he will not spare when he takes revenge.
35He will accept no compensation;
he will refuse though you multiply gifts.
Note:
Proverbs 6:26 Or (compare Septuagint, Syriac, Vulgate)
for a prostitute leaves a man with nothing but a loaf of bread
The OP is more than a little interpretative, and ignores the remainder of the passage:
The phrase "it is better" is added...
"It is better to lay with a prostitute and pay the price of a loaf of bread, rather than betray your wife and lose everything"