Returning a const pointer by value is a terrible example.
The compiler is required to ignore the const-qualifier on the scalar return type.
Also note that std::vector<>::data() returns a non-const pointer (to const) by value.
1 2 3 4 5 6
// return const pointer to const T by value
const T* const foo() ; // bad; avoid (drop the const, it is ignored anyway)
// heed the warning: const-qualifier ignored on function return type
// return non-const pointer to const T by value
const T* bar() ; // fine; we are returning a non-const object by value
It is not recommended to return a const value. Such older advice is now obsolete; it does not add value, and it interferes with move semantics.
The argument for adding const to a return value is that it prevents (very rare) accidental access to a temporary. The argument against is prevents (very frequent) use of move semantics.
the "older advice" refers to, I believe, pre-C++11 Scott Meyers who recommended returning const class objects to block non-const member function calls on temporaries (which are actually not always a bad idea)