how is stalemate achieved?
If one side has no legal moves, it's stalemate. Remember the king can't move into check. Here's a whole article...
https://support.chess.com/article/682-what-is-stalemate
one side has no legal moves + their king is in check = checkmate
one side has no legal moves + their king is not in check = stalemate