Playing samples in a loop, without clicks or pops
The popping comes from discontinuities in the signal or its derivative.  Even if you match the starting sample value with the ending one, you will still have a "corner" in most cases.  Imagine a pure sine wave of one frequency at the start and a pure sine wave of another at the end. Discontinuities tend to produce a lot of high frequency noise.  Your second solution using the low pass filter eliminated that noise (it smoothed out the signal), but at the cost of eliminating the signal too.

The simplest solution to this is just to crossfade the end into the start.  Admittedly, at typical playback rates (22KHz) you are looping about 200ms which gives very little time to fade in/out.  At this point, you may be closer to doing an (overlapped) window function.  Doing an abrupt crossfade would be roughly akin to a Tukey window.