When you are dealing with disproving a conjecture (like that by Kaplansky) you don’t need to know how the counterexample has been found to asses whether it works. The same applies to the case of solutions  of algebraic equations that you mentioned. In either case the authors more or less explicitly said they didn’t want to share their methods.

It seems that you can’t do that when, for instance, proving a conjecture that everyone thinks it’s true. However, a not-so-rare thing is to find papers in which very nice results follow from relatively simple arguments, which you can follow perfectly but still can’t figure out how they were conceived. This can apply to very old pieces of math, like for instance some proofs by Archimedes. A good example is the case in which he determines the direction of the tangent to the (Archimedean) spiral, which follows from a lengthy argument consisting of many technical Lemmas, where I never managed to grasp a general direction of reasoning and still regard as something a bit mysterious.

Other examples are most of the arguments in the wonderful “Proofs from the Book”, by Aigner and Ziegler (available here: https://archive.org/details/proofsfrombook00aign_348/page/n131/mode/2up). In these cases, there is no explicit intention of hiding anything, but still the results look so pretty that you wonder how they were developed in that precise form.

(And of course the quintessential case of this kind is Fermat’s last theorem, in which the alleged solution was not shared for lack of space...but perhaps this better fits in the category of “jokes”).