Why would it be f/2.8? The 24 f/2.8 IS isn't large, but it's not a pancake either. A 24mm pancake that is f/4 would make more sense, but I'm not sure how useful it'd be a crop camera.
24mm & 28mm f2.8 IS is very good small prime, but the price is around 4 times to 40mm pancake.
The non-L IS refresh lenses (24/28/35) and the pancakes are different animals. Similar sharpness and similar max aperture, but the non-L IS lenses get you some very nice things:
- Much faster focusing -- USM vs. STM is no contest
- IS is lovely for low-light handheld work
- Higher build quality. The 24/28/35 lenses feel like the 100L macro for 'solidness', precision, lack of rattle or play with the rings, etc. The pancake is certainly nicer than the nifty fifty 50 F/1.8, but it's not as well put together as the 24/28/35 lenses. In short, there is much more to build quality than if the ring is metal -- I'd compare these very lenses to make that point.
- Internal focusing -- does not change length while focusing. The pancake extends out depending on focus distance.
- For two of the three FL (24 and 28), you get a 58mm filter ring, which is probably is the a common diameter for folks stepping up from their crop kit lenses. The pancake has a 52mm ring which is fairly uncommon for DSLR owners to have in their bag these days.
- Full-time mechanical manual focusing -- the pancake has focus by wire
- Proper bayonet hoods are offered -- the pancake has a screw-in hood that some do not like.
- Greater max magnification (0.23-0.24x vs. 0.18x)
- Has a distance scale -- the pancake does not
In short, the non-L IS refresh lenses are (nearly) fully featured lenses with the bells and whistles photographers count on. The pancake is a stripped down photography tool that takes sharp pictures but can limit the photographer for the reasons listed above.
I've also heard in some reviews that the pancake is specifically for more wide-open-end applications (where it is truly remarkable), and that the lens gets softer (I presume from diffraction) more quickly when you stop down past F/8, F/11 or so than a conventional lens might. Bryan Carnathan from TDP also spoke of a small focus shift with the pancake, but still gave it his highest 'star' rating, given the value.
The pancake is still a stellar value and takes remarkably sharp pictures, but understand that at that price, you don't get everything
. Many features you may / may not care about will be missing. In full disclosure, I own the 40 pancake and the 28 F/2.8 IS and the 28 gets used easily 10x more for the reasons above. The 40 is relegated to ultralight walkaround detail when I may / may not need my camera. Glad to have it, but I rarely need it.