When custom software is the cheaper option
Usually it isn't. Here is the specific case where it is, and how to tell which one you are in.
Off-the-shelf almost always wins. It wins on price, on support, and on the fact that someone else fixes it at 2am.
Custom becomes cheaper in one specific case: when the off-the-shelf tool almost fits, and the gap is being closed by a person doing manual work every day. Then you are already paying for custom software — in wages — and just not getting to keep it.
The test is simple: if someone on your team spends an hour a day re-keying data between two systems, price out the tool that would remove that hour. You are usually comparing it against a cost you have stopped noticing because it hides in a salary.