It means that these are two areas of the human condition where there are no rules - you do what you feel you can justify in order to win. Like all cliches, it has passed into common usage because it's true, and most people know that from experience of one or the other, or even both.
"All's fair in love and war" is actually a quotation from the 19th century novel "Frank Farleigh" by F E Smedley. But Miguel Cervantes (1547 - 1616) expressed the same thought in Don Quixote - "Love and war are the same, and strategies and tricks are allowable in both".